AI Zone Admin Forum Add your forum

CHATBOT MEETUP CHATBOT MEETUP CHATBOT MEETUP CHATBOT CHATBOT MEETUP CHATBOT MEETUP CHATBOT MEETUP CHATBOT MEETUP

On June 28th, 2017 we're organizing our next Chatbot Meetup in Amsterdam, The Netherlands. Feel free to join!'

In chatscript have function like trim() in java?
 
 

i’m using CS and interacting with FB messenger.
Anyone know remove gap function?
like
‘Im mortal’ -> ‘immortal’
‘skt t1 faker’ -> ‘sktt1faker’

 

 
  [ # 1 ]
Tae Hyung Kim - Apr 5, 2017:

i’m using CS and interacting with FB messenger.

if user typing id on messenger to find own information.
There are many kinds of id.
someone id is ‘sando’, ‘exam’ that is not a problem because have no gap.
but my CS bot problem occure userid have gap like ’ skt t1 faker’, ‘kt mgs’.
so i want to remove gap in userid compress string
‘kt mgs’ -> ‘ktmgs’
‘skt t1 faker’ -> ‘sktt1faker’

Is anyone else problem like me?

 

 
  [ # 2 ]

Hi Tae,

I do not think there is a trim function but there is a ^substitute function that you can use to replace the spaces.  You could make a function or outputmacro and rename it to ^trim or to ^removespaces like:

Place this at the top of your topic file:
outputmacro: ^removespaces(^text)
^substitute(character ^text ” ” “” )

Then test with this pattern:

u: (remove spaces in _* ) ^keep() ^repeat() ^removespaces(‘_0)

sample output:
HARRY:  Welcome to ChatScript.
alaric: > remove spaces in a b c
HARRY:  Abc

 

 

 
  [ # 3 ]

thanks Alaric! btw to let the initial “a” not capitalized to “A”  you maybe want to do:

^removespaces( ^original(_0) )

 

 
  login or register to react