2

I need to format a CString that contains a phone number.

I need to remove all spaces and all characters that are not a number.

Please advice on how I can do this.

tel1 = replace(tel1,' ','')

That is how it would be done in C# but I don't have a clue how to do it in Clarion.

DanM7
  • 2,203
  • 3
  • 28
  • 46
Arno Botha
  • 59
  • 1
  • 6

2 Answers2

2

As Griffo mentioned, the built-in procedure DeFormat should do this for you.

There is no online help for Clarion, this is copied from relevant section:

The DEFORMAT procedure removes formatting characters from a numeric string, returning only the numbers contained in the string.

tel1 = '(02) 1234-5678'
tel1 = DeFormat(tel1)
! tel1 now contains 0212345678
brahnp
  • 2,276
  • 1
  • 17
  • 22
1
tel1 = deformat(tel1)

Check out Deformat in your help

Griffo
  • 103
  • 1
  • 6
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment). – PaperBirdMaster Apr 10 '14 at 06:59
  • 1
    @PaperBirdMaster - this was actually the right answer, though a little lacking in details. Griffo - next time add an example, and for a language like Clarion that doesn't have online docs, copy the info from your docs up here for everyone to reference. – DanM7 May 19 '14 at 20:50