Knowing Your Equipment


As you embark on the journey of writing SenseTalk, there are a few basics you'll need to be familiar with. Here we cover some of the fundamental equipment you'll need, from text and lists to loops and conditionals.
Working with Text
SenseTalk's text handling abilities are extensive and extremely powerful, and at the same time very readable and people oriented.
Text operators include:
&for joining (concatenating) two strings&&for joining two strings with a space in betweencontains,is infor determining if one string contains anotherbegins with,ends withfor determining if a string begins or ends with anothermatchesfor determining if a string matches a given pattern
Chunk Expressions
SenseTalk's chunk expressions let you work with text in a natural way. A chunk expression can directly identify characters, words, items (delimited by commas, by default), or lines of text, either for accessing or modifying part of a string.
put characters 3 to 9 of acctNum into branchNum
put the first 3 chars of word 2 of "library catalog" --> "cat"
A chunk of a container is also a container, meaning that it can be modified by any command that operates on variables or other containers.
set text to "my flower are beautiful"
put "s" after word 2 of text
put text --> "my flowers are beautiful"
add 1 to the last item of line 7 of file "counters.txt"
Patterns
SenseTalk's pattern language provides all the capabilities of regular expressions, but in a readable way.
set sentence to "Please use addresses of the form 42.212.86.x"
put every occurrence of <1 to 3 digits, then "."> in sentence --> ["42.","212.","86."]