Length of a String without using in-built methods (like Length)
Sometime we have to get length of string but we don't have to use in-built method like Length in c#.
Let's make a method to get length of string
Let's make a method to get length of string
public int LengthOfString(string _strkey) { int _length = 0; bool isTrue = false; do { try { char _char = _strkey[_length]; _length++; } catch (IndexOutOfRangeException) { isTrue = true; } } while (!isTrue); { return _length; } }
Comments
Post a Comment