Skip to main content

getNewUpperCaseString

Short summary

this methods copy a string and returns the start address of new string, all small letters are capitalized in the new string.

:return: start address of a string. If createNewUpperCaseString is TRUE then it's a new string

  • Return type: POINTER TO BYTE

Parameters

NameTypeCommentKind
stringAddressPOINTER TO BYTEstart address of the string to copy and capitalizeinput
stringLengthUDINTlength of the string stringAddressinput
createNewUpperCaseStringBOOLTRUE means meake a copy and capitalize it, FALSEmeans return juststringAddress`` and do nothing elseinput
sbcsTypeTc2_Utilities.E_SBCSTypeused Single Byte Character Set (SBCS), is set in Tc2_Utilities.GLOBAL_SBCS_TABLEinput

Code

Declaration

METHOD PROTECTED getNewUpperCaseString :POINTER TO BYTE; 
VAR_INPUT
(* start address of the string to copy and capitalize *)
stringAddress :POINTER TO BYTE;
(* length of the string ``stringAddress`` *)
stringLength :UDINT;
(*
``TRUE means meake a copy and capitalize it,
``FALSE`` means return just ``stringAddress``
and do nothing else
*)
createNewUpperCaseString :BOOL;
(* used Single Byte Character Set (SBCS), is set in Tc2_Utilities.GLOBAL_SBCS_TABLE *)
sbcsType :Tc2_Utilities.E_SBCSType := Tc2_Utilities.E_SBCSType.eSBCS_WesternEuropean;
END_VAR

Implementation

IF (createNewUpperCaseString) THEN
getNewUpperCaseString := THIS^.getStringCopy(stringAddress, stringLength);
THIS^.upperCase(getNewUpperCaseString, stringLength, sbcsType := sbcsType);
ELSE
getNewUpperCaseString := stringAddress;
END_IF