Like what I have to say? Subscribe to my blog via RSS or email, and you'll be notified whenever there's a new blog post!
 
Subscribe to Alvin Poh's Blog by RSS reader
Subscribe to Alvin Poh's Blog by Email

Gadgets, Technology, Public speaking and IT from an undergraduate's perspective.

Replace/remove character in a String

To replace all occurences of a given character :

String.replaceAll("n", ""); // Remove all n
String.replaceAll("n", "r"); // Replace n by r

To replace a character at a specified position :

public static String replaceCharAt(String s, int pos, char c) {
return s.substring(0,pos) + c + s.substring(pos+1);
}

To remove a character :

public static String removeChar(String s, char c) {
String r = "";
for (int i = 0; i < s.length(); i ++) {
if (s.charAt(i) != c) r += s.charAt(i);
}
return r;
}

To remove a character at a specified position:

public static String removeCharAt(String s, int pos) {
return s.substring(0,pos)+s.substring(pos+1);
}

Subscribe to my blog: RSS reader    Email

Speed Up Your Internet Connection

This is a great and free service that’s getting to be very popular. It’s called OpenDNS, and what it does is to offer a better DNS service. You can use OpenDNS immediately at home, at work, or on your mobile.

Confused? What’s DNS anyway? Read up about DNS first (Wikipedia) .

I tried setting it up on my home’s wireless network, and got everything up within a minute! (Basically I just needed to update my wireless router’s DNS settings to that of OpenDNS’s)

OpenDNS helps you navigate the Internet in a safer, faster, smarter and more reliable way. It requires nothing to download. OpenDNS doesn’t replace your existing Internet connection, it just makes it better.

Try it out! Visit OpenDNS.

Subscribe to my blog: RSS reader    Email