Question: ```
      sLine = sLine.replaceAll("&&", "&"); 
      sLine = sLine.replaceAll(((char)245)+"", "ő");
      sLine = sLine.replaceAll(((char)213)+"", "Ő");
      sLine = sLine.replaceAll(((char)361)+"", "ű");
      sLine = sLine.replaceAll(((char)251)+"", "ű");

```

Is there a way to to this only one line? This is very slow on big strings.

Answer: 
Consider converting the string to a `char[]` and then iterating over the array manually.

Avoid string concatenation such as `((char)245)+""`. Use a character constant.

But it looks like you are trying to *fix the encoding of strings* manually? That is a *really bad idea*. Because next week, you will have a user with the `ü` character. And then, someone will use a `€` currency value. And then a spanish user will want to use the `¿` character. How many `replaceAll` are you willing to add?!?

Look at how to **encode/decode/recode strings**.

Maybe use the following constructor instead:

```
String(byte[] bytes, Charset charset) 

```

and look at the Java Charset classes: 

* [java.nio.charset.Charset](http://docs.oracle.com/javase/6/docs/api/java/nio/charset/Charset.html)
* [java.nio.charset.CharsetDecoder](http://docs.oracle.com/javase/6/docs/api/java/nio/charset/CharsetDecoder.html)
* [java.nio.charset.CharsetEncoder](http://docs.oracle.com/javase/6/docs/api/java/nio/charset/CharsetEncoder.html)
You can improve performance by using precompiled regular expressions. Under the hood `String.replaceAll` is going to compile and apply a regular expression for you anyway. As compilation of the regexp is *relatively* computationally intensive, this should improve performance when executing this code frequently.

```
private static final Pattern PATTERN_1 = Pattern.compile("\u00f5");
private static final Pattern PATTERN_2 = Pattern.compile(Character.toString((char) 241));

String original = new String("A" + (char) 245 + "\u00f1" + "D");
String replaced2 = PATTERN_1.matcher(original).replaceAll("B");
replaced2 = PATTERN_2.matcher(replaced2).replaceAll("C");
System.out.println(original + " -> " + replaced2);

```

Will print out:

> 
> A??D -> ABCD
> 
> 
> 

When working with a very very long `String` this probably won't offer much performance over what you proposed.

**As an aside:**
Using non UTF-8 characters in code will cause you (and your colleagues) pain down the road. You should use [Unicode characters](http://oreilly.com/actionscript/excerpts/as3-cookbook/appendix.html) or, as you were, character decimal representations at all times.