88 Retval = OREF_NULLSTRING;
95 LeftPad = (Width - Len) / 2;
96 RightPad = (Width - Len)-LeftPad;
97 Space = RightPad + LeftPad + Len;
105 memcpy(Retval->
getWritableData() + LeftPad, this->getStringData(), Len);
108 memset(Retval->
getWritableData() + LeftPad + Len, (
int)PadChar, RightPad);
113 LeftPad = (Len - Width) / 2;
144 if (DeletePos > StringLen)
152 if (DeleteLen >= (StringLen - DeletePos))
158 BackLen = StringLen - (DeletePos + DeleteLen);
168 Current += DeletePos;
174 memcpy(Current, this->
getStringData() + DeletePos + DeleteLen, BackLen);
225 TargetSize = TCharLen;
233 else if (NChar >= TCharLen)
235 ReqLeadPad = (NChar - TCharLen);
243 BCharLen = TCharLen - NChar;
246 ReqPadChar = ReqLenChar - NCharLen;
248 BuffSiz = NCharLen + TargetSize + ReqPadChar + ReqLeadPad;
261 memset(Current, (
int)PadChar, ReqLeadPad);
262 Current += ReqLeadPad;
275 memset(Current, (
int)PadChar, ReqPadChar);
276 Current += ReqPadChar;
313 Retval = OREF_NULLSTRING;
325 Current += CopyLength;
330 memset(Current, (
int)PadChar, Size - Length);
371 if (OverlayLen > NewLen)
372 BackPad = OverlayLen - NewLen;
379 if (OverlayPos > TargetLen)
382 FrontPad = OverlayPos - TargetLen - 1;
383 FrontLen = TargetLen;
388 FrontLen = OverlayPos - 1;
391 if (OverlayPos + OverlayLen > TargetLen)
398 BackLen = TargetLen - (OverlayPos + OverlayLen - 1);
401 Retval =
raw_string(FrontLen + BackLen + FrontPad + OverlayLen);
414 memset(Current, (
int)PadChar, FrontPad);
428 memset(Current, (
int)PadChar, BackPad);
435 memcpy(Current, this->
getStringData() + OverlayPos + OverlayLen - 1, BackLen);
476 if (replacePos > targetLen)
478 padding = replacePos - targetLen - 1;
479 frontLen = targetLen;
484 frontLen = replacePos - 1;
487 if (replacePos + replaceLen - 1 < targetLen)
490 backLen = targetLen - (replacePos + replaceLen - 1);
506 memset(current, (
int)padChar, padding);
519 memcpy(current, this->
getStringData() + replacePos + replaceLen - 1, backLen);
547 while (Length-- != 0)
555 Retval = OREF_NULLSTRING;
588 Retval = OREF_NULLSTRING;
599 memset(Current, (
int)PadChar, Size - Length);
600 Current += Size - Length;
605 memcpy(Current, this->
getStringData() + Length - CopyLength, CopyLength);
661 const char *back = front +
length - 1;
681 return OREF_NULLSTRING;
void reportException(wholenumber_t error)
codepoint_t optionalPadArgument(RexxObject *o, codepoint_t d, size_t p)
RexxString * stringArgument(RexxObject *object, RexxString *kind, size_t position)
size_t optionalLengthArgument(RexxObject *o, size_t d, size_t p)
char optionalOptionArgument(RexxObject *o, char d, size_t p)
size_t optionalPositionArgument(RexxObject *o, size_t d, size_t p)
RexxString * optionalStringArgument(RexxObject *o, RexxString *d, RexxString *kind, size_t p)
#define Error_Incorrect_method_option
RexxString * raw_string(stringsize_t l)
RexxString * new_string(const char *s, stringsize_t l)
stringsize_t positionArgument(RexxObject *argument, size_t position)
stringsize_t lengthArgument(RexxObject *argument, size_t position)
static wholenumber_t minVal(wholenumber_t n1, wholenumber_t n2)
RexxString * delstr(RexxInteger *, RexxInteger *)
RexxString * overlay(RexxString *, RexxInteger *, RexxInteger *, RexxString *)
const char * getStringData()
RexxString * left(RexxInteger *, RexxString *)
RexxString * subchar(RexxInteger *)
RexxString * substr(RexxInteger *, RexxInteger *, RexxString *)
RexxString * replaceAt(RexxString *, RexxInteger *, RexxInteger *, RexxString *)
RexxString * right(RexxInteger *, RexxString *)
RexxString * insert(RexxString *, RexxInteger *, RexxInteger *, RexxString *)
RexxString * strip(RexxString *, RexxString *)
RexxString * center(RexxInteger *, RexxString *)
static bool matchCharacter(char ch, const char *charSet, size_t len)
static RexxString * subchar(const char *stringData, size_t stringLength, RexxInteger *positionArg)
static RexxString * substr(const char *, size_t, RexxInteger *, RexxInteger *, RexxString *)