User Tools

Site Tools


acase

Table of Contents

acase

alternate case - a string processing function that returns a string argument with each letter alternated.

syntax

acase(string)

  • string can be a string variable, function or literal

See also lcase, pcase, tcase, ucase

details

acase works with variable-, fixed-length and constant strings. The result can be assigned to a variable or fixed-length string, and passed to a string parameter or function result. If the specified string is in lowercase then acase has the same effect as ucase. If the specified string is in uppercase then acase has the same effect as lcase.

example

This example converts a string to alternate case, then to lowercase and finally to uppercase using acase.

' SharpBASIC acase programming example
' ------------------------------------
incl "lib/sys.sbi";

dim s: str = "heLLo wOrlD!";

main do
  print(s);
  ' alternate case
  s = acase(s);
  print(s);
  ' lowercase
  s = lcase(s);
  print(s);
  ' alternating lowercase to uppercase
  s = acase(s);
  print(s);
end
Output:

heLLo wOrlD!

HEllO WoRLd!

hello world!

HELLO WORLD!

acase.txt · Last modified: 2023/06/26 00:29 by admin