length method of string class in scala code example Example: scala length of string var palindrome = "Dot saw I was Tod"; var len = palindrome.length();