home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / tpwinst / doc.pak / STRINGS.INT < prev    next >
Text File  |  1991-05-21  |  5KB  |  124 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Turbo Pascal Runtime Library                    }
  5. {       String Handling Unit                            }
  6. {                                                       }
  7. {       Copyright (C) 1991 Borland International        }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. unit Strings;
  12.  
  13. {$D-,S-}
  14.  
  15. interface
  16.  
  17. { StrLen returns the number of characters in Str, not counting  }
  18. { the null terminator.                                          }
  19.  
  20. function StrLen(Str: PChar): Word;
  21.  
  22. { StrEnd returns a pointer to the null character that           }
  23. { terminates Str.                                               }
  24.  
  25. function StrEnd(Str: PChar): PChar;
  26.  
  27. { StrMove copies exactly Count characters from Source to Dest   }
  28. { and returns Dest. Source and Dest may overlap.                }
  29.  
  30. function StrMove(Dest, Source: PChar; Count: Word): PChar;
  31.  
  32. { StrCopy copies Source to Dest and returns Dest.               }
  33.  
  34. function StrCopy(Dest, Source: PChar): PChar;
  35.  
  36. { StrECopy copies Source to Dest and returns StrEnd(Dest).      }
  37.  
  38. function StrECopy(Dest, Source: PChar): PChar;
  39.  
  40. { StrLCopy copies at most MaxLen characters from Source to Dest }
  41. { and returns Dest.                                             }
  42.  
  43. function StrLCopy(Dest, Source: PChar; MaxLen: Word): PChar;
  44.  
  45. { StrPCopy copies the Pascal style string Source into Dest and  }
  46. { returns Dest.                                                 }
  47.  
  48. function StrPCopy(Dest: PChar; Source: String): PChar;
  49.  
  50. { StrCat appends a copy of Source to the end of Dest and        }
  51. { returns Dest.                                                 }
  52.  
  53. function StrCat(Dest, Source: PChar): PChar;
  54.  
  55. { StrLCat appends at most MaxLen - StrLen(Dest) characters from }
  56. { Source to the end of Dest, and returns Dest.                  }
  57.  
  58. function StrLCat(Dest, Source: PChar; MaxLen: Word): PChar;
  59.  
  60. { StrComp compares Str1 to Str2. The return value is less than  }
  61. { 0 if Str1 < Str2, 0 if Str1 = Str2, or greater than 0 if      }
  62. { Str1 > Str2.                                                  }
  63.  
  64. function StrComp(Str1, Str2: PChar): Integer;
  65.  
  66. { StrIComp compares Str1 to Str2, without case sensitivity. The }
  67. { return value is the same as StrComp.                          }
  68.  
  69. function StrIComp(Str1, Str2: PChar): Integer;
  70.  
  71. { StrLComp compares Str1 to Str2, for a maximum length of       }
  72. { MaxLen characters. The return value is the same as StrComp.   }
  73.  
  74. function StrLComp(Str1, Str2: PChar; MaxLen: Word): Integer;
  75.  
  76. { StrLIComp compares Str1 to Str2, for a maximum length of      }
  77. { MaxLen characters, without case sensitivity. The return value }
  78. { is the same as StrComp.                                       }
  79.  
  80. function StrLIComp(Str1, Str2: PChar; MaxLen: Word): Integer;
  81.  
  82. { StrScan returns a pointer to the first occurrence of Chr in   }
  83. { Str. If Chr does not occur in Str, StrScan returns NIL. The   }
  84. { null terminator is considered to be part of the string.       }
  85.  
  86. function StrScan(Str: PChar; Chr: Char): PChar;
  87.  
  88. { StrRScan returns a pointer to the last occurrence of Chr in   }
  89. { Str. If Chr does not occur in Str, StrRScan returns NIL. The  }
  90. { null terminator is considered to be part of the string.       }
  91.  
  92. function StrRScan(Str: PChar; Chr: Char): PChar;
  93.  
  94. { StrPos returns a pointer to the first occurrence of Str2 in   }
  95. { Str1. If Str2 does not occur in Str1, StrPos returns NIL.     }
  96.  
  97. function StrPos(Str1, Str2: PChar): PChar;
  98.  
  99. { StrUpper converts Str to upper case and returns Str.          }
  100.  
  101. function StrUpper(Str: PChar): PChar;
  102.  
  103. { StrLower converts Str to lower case and returns Str.          }
  104.  
  105. function StrLower(Str: PChar): PChar;
  106.  
  107. { StrPas converts Str to a Pascal style string.                 }
  108.  
  109. function StrPas(Str: PChar): String;
  110.  
  111. { StrNew allocates a copy of Str on the heap. If Str is NIL or  }
  112. { points to an empty string, StrNew returns NIL and doesn't     }
  113. { allocate any heap space. Otherwise, StrNew makes a duplicate  }
  114. { of Str, obtaining space with a call to the GetMem standard    }
  115. { procedure, and returns a pointer to the duplicated string.    }
  116. { The allocated space is StrLen(Str) + 1 bytes long.            }
  117.  
  118. function StrNew(Str: PChar): PChar;
  119.  
  120. { StrDispose disposes a string that was previously allocated    }
  121. { with StrNew. If Str is NIL, StrDispose does nothing.          }
  122.  
  123. procedure StrDispose(Str: PChar);
  124.