I found an interesting behavior with umlaut characters (ö,ü …). When we calculate the length of a string having umlaut characters (using string length function), different language compilers gives the different results.
I did some testing in some programming & scripting languages, and got some interesting results. Have a look
Java 5:
“ü”.length(); //output : 2 (count 2 for umlaut character)
“üö”.length(); //output : 4
“aüö”.length(); //output : 5 (count 1 for simple characters and 2 for umlaut characters)
Javascript (tested on Firefox 2.0, IE6.0):
“ü”.length; //output : 1
“üö”.length; //output : 2
“aüö”.length; //output : 3
VBScript (tested on IE6.0):
Len(“ü”) //output : 1
Len(“üö”) //output : 2
Len(“aüö”) //output : 3
C#.NET (2005):
“ö”.Length; //output : 1
“üö”.Length; //output : 2
“aüö”.Length;//output : 3
VB.NET (2005):
“ö”.Length //output : 1
“üö”.Length //output : 2
“aüö”.Length//output : 3
PHP:
strlen(“ü”); //output : 2 (count 2 for umlaut character)
strlen(“üö”); //output : 4
strlen(“aüö”); //output : 5 (count 1 for simple characters and 2 for umlaut characters)
Turbo C++:
strlen(“ü”); //output : 1
strlen(“üö”); //output : 2
strlen(“aüö”); //output : 3
Your comments and views are invited.
What a dhasu blog… I love it…It gives me that information that i want urgently..Thanks mohit…ur just a true frnd….GOD BLESS U…ALWAYS…
Your blog is interesting!
Keep up the good work!