When handling strings, nuBASIC uses the set of ASCII characters. 

The Asc and Chr functions allow the ASCII value belonging to a character to be established and/or the corresponding character to be found for a ASCII value.


Print Asc("A") 

Print Chr(65) 

The Chr function is often used in Basic languages to insert control characters in a string. 

The following assignment 

MyString$ = Chr(9) + "Hello World" + Chr(13)

ensures that the text is preceded by a tab character (ASCII-value 9) and that a hard line break (ASCII-value 13) is added after the text. 
nuBASIC provides three functions that return partial strings, plus a length function: 
  • Left[$](x$,n) Returns a string that comprises the left-most n characters of x$ 
  • Mid[$](x$,n,m) Returns a string of m characters from x$ beginning with the nth character 
  • Right[$](x$,n) Returns a string that comprises the right-most n characters of x$ 
  • Len(x$) Returns the number of characters in x$ 

nuBASIC provides the InStr function for searching for a partial string within another string.


ResultString% = InStr(MyString$, SearchString$)

The SearchString$ parameter specifies the string to be searched for within MyString$. The function returns a number that contains the position at which the SearchString$ first appears within MyString$ or -1 otherwise. 

InStr ignores uppercase and lowercase characters. 
InStrCs is the case sensitive version of InStr.