Logo
Zoho Forums
Can anyone help me?  This seems like a stupid problem but I'm stumped.  Our accounting has to have SS numbers formatted with hyphens, but our users do not always enter them. Since creator currently has no input masking functionality (to correct format in user-entered phone numbers, serial numbers, etc), I need a work around.

I've got no problem stripping out hyphens, dots, spaces, etc. to create a clean unpunctuated number, but I just can't figure out how to get the hypnens put  in the correct places!  There doesn't seem to be a built in function for extracting characters from a string based on their position in a string (1st, 2nd, 3rd).  I need to extract the first three characters, then the next two, etc. 

Can someone help with this string question or suggest an alternative workaround for the mask?

Thanks a bunch,
Dax


  • No status
  • Working on it
  • Answered
  • Need more info
  1 user has this question 



 There doesn't seem to be a built in function for extracting characters from a string based on their position in a string (1st, 2nd, 3rd).

Dax,

actually there is such a built in function, look for substring(<s.index>, <e.index>) at

http://help.creator.zoho.com/Built-in-Functions.html#String_functions

If you have problems using this function, maybe a helpful thing would be to search for substring in this Zoho Creator forum - these problems were debated here months ago.


Regards,
George

 Hi,

It is possible to create a clean unpunctuated number from formatted phone number using the Built-in-Functions(getAllAlphaNumeric() and removeAllAlpha()).

I have created a sample application and it is available here .

Following is the code snippet used

  1.  string getCleanNum(string num)
  2. {
  3.     input.num = input.num.getAlphaNumeric();
  4.     input.num = input.num.removeAllAlpha();
  5.     return input.num;
  6. }


Thanks,
Nandhini P

Hi Nandhini,

As I explained in my post, I already created a function to remove the extra characters. 
 
I am going to give George's suggestion a shot and search on substring.  (thanks George!)

Reading the forum, it looks like in the past, input masks were a problem for zoho.  (Non-americans had problems removing american phone formating, etc). 

In other scripting languages, rather than using a pre-defined format for phone, ss#, etc, there is simply a facility for the developer to define her own masks, such as ###-##-####.  That general masking capaility would be more useful to us, I believe, than specific field types for phone, etc.

stressrecess:

I am assuming that after you have something like "abcdefghi" in a (string) variable ... you want to know how to transform it into something else like "abc-de-fghi".

If so, start here ... http://help.creator.zoho.com/Built-in-Functions.html ... under the section titled String Functions, look at ...

a) <string1>.substring(<s.index>, <e.index>) ... read the Description for this built-in function very carefully ... as ZOHO Creator has a unique method for specifying the starting and ending position values ... you might even consider whipping up a Stateless Form with 4 fields ... source, start position, end position and result ... and observe ZOHO Creator's behaviour for the various combinations ... that was how I learned about its quirky behaviour.

b) <string>.length() ... because ZOHO creator is unforgiving when you specify values beyond the length of a string.


Gaev

 Back
 Top
Post Actions
Statistics
  • 4
     Replies
  • 122
     Views
  • 0
     Followers
Tags for the post
No tags available for this topic.

Edit Link Delete Link

Edit Link Delete Link

LoadingImage