Is there a function to return the length of a string?

8
Is there a function to return the length of a string? Something like length($someString) There are other string functions that would be useful - LENGTH(string) - return length of string LEFT(string,nn) - return nn left side characters RIGHT(string,nn) - return nn right side characters LPAD(string, 'xxx', nn) - left pad a string to length nn with characters xxx RPAD(string, 'xxx', nn) - right pad a string to length nn with characters xxx Background - I am trying to normalize phone numbers entered for a text-to-speech notification engine. The user might enter +44 (0) 1494 468980 or 01494 468980 as the number. I can strip this to 4401494468980 or 01494468980, but I know national numbers are 10 digits, so I want to check the length and return right 10 characters 1494468980. I can then add the national prefix (0) or international (0044) depending on where the call is being made from.
asked
3 answers
8

Version 2.5 of our technology includes a function to determining the length of a string (unsurprisingly called 'length') and a function to get an arbitrary part of a string (called 'substring').

In version 2.4 you have to use Java as Michel suggests.

answered
3

I think such problems are the easiest to solve by writing a Java function for it. If you are familiar with them, i suggest the usage of regular expressions for this kind of problems, see this thread:

answered
0

There are other string functions that would be useful -

LENGTH(string) - return length of string LEFT(string,nn) - return nn left side characters RIGHT(string,nn) - return nn right side characters LPAD(string, 'xxx', nn) - left pad a string to length nn with characters xxx RPAD(string, 'xxx', nn) - right pad a string to length nn with characters xxx

answered