Что-то не то Вы нашли.
sg (16:46) :
Returns a string with occurrences of one substring replaced by another substring.
Unit
SysUtils
Category
string handling routines
Delphi syntax:
function StringReplace(const S, OldPattern, NewPattern: string; Flags: TReplaceFlags): string;
C++ syntax:
extern PACKAGE AnsiString __fastcall StringReplace(const AnsiString S,
const AnsiString OldPattern, const AnsiString NewPattern, TReplaceFlags Flags);
Description
StringReplace replaces occurrences of the substring specified by OldPattern with the substring specified by NewPattern. StringReplace assumes that the source string may contain Multibyte characters.
S is the source string, whose substrings are changed.
OldPattern is the substring to locate and replace with NewPattern.
NewPattern is the substring to substitute for occurrences of OldPattern.
Flags is a set of flags that govern how StringReplace locates and replaces occurrences of OldPattern. If Flags does not include rfReplaceAll, StringReplace only replaces the first occurrence of OldPattern in S. Otherwise, StringReplace replaces all instances of OldPattern with NewPattern. If the Flags parameter includes rfIgnoreCase, The comparison operation is case insensitive.
Привет, Sr.!
Вы пишешь 16 февраля 2005:
SM> Есть строка (AnsiString) вида: " ПК ##+##.### "
SM> Как в ней заменить "+" на "ё"?
StringReplace()
--
With best regards, Alex Cherednichenko.
Posted via RSDN NNTP Server 1.9
Привет, Sr.!
Вы пишешь 16 февраля 2005:
SM> А по подробнее? Справочка по ней жиденькая...
А ты почитай, почитай...
--
With best regards, Alex Cherednichenko.
Posted via RSDN NNTP Server 1.9
The AnsiString handling routines cover several functional areas. Within these areas, some are used for the same purpose, the differences being whether they use a particular criterion in their calculations. The following tables list these routines by these functional areas:
Comparison
Case conversion
Modification
Sub-string
Where appropriate, the tables also provide columns indicating whether a routine satisfies the following criteria.
Uses case sensitivity: If locale settings are used, it determines the definition of case. If the routine does not use locale settings, analyses are based upon the ordinal values of the characters. If the routine is case-insensitive, there is a logical merging of upper and lower case characters that is determined by a predefined pattern.
Uses locale settings: Locale settings allow you to customize your application for specific locales, in particular, for Asian language environments. Most locale settings consider lowercase characters to be less than the corresponding uppercase characters. This is in contrast to ASCII order, in which lowercase characters are greater than uppercase characters. Routines that use the Windows locale are typically prefaced with Ansi (that is, AnsiXXX).
Supports the multi-byte character set (MBCS): MBCSs are used when writing code for far eastern locales. Multi-byte characters are represented as a mix of one- and two-byte character codes, so the length in bytes does not necessarily correspond to the length of the string. The routines that support MBCS parse one- and two-byte characters.
ByteType and StrByteType determine whether a particular byte is the lead byte of a two-byte character. Be careful when using multi-byte characters not to truncate a string by cutting a two-byte character in half. Do not pass characters as a parameter to a function or procedure, since the size of a character cannot be predetermined. Pass, instead, a pointer to a to a character or string. For more information about MBCS, see Enabling application code.
String comparison and case conversion routines:
Routine Case-sensitive Uses locale settings Supports MBCS
AnsiCompareStr yes yes yes
AnsiCompareText no yes yes
AnsiCompareFileName no yes yes
AnsiMatchStr yes yes yes
AnsiMatchText no yes yes
AnsiContainsStr yes yes yes
AnsiContainsText no yes yes
AnsiStartsStr yes yes yes
AnsiStartsText no yes yes
AnsiEndsStr yes yes yes
AnsiEndsText no yes yes
AnsiIndexStr yes yes yes
AnsiIndexText no yes yes
CompareStr yes no no
CompareText no no no
AnsiResemblesText no no no
Routine Uses locale settings Supports MBCS
AnsiLowerCase yes yes
AnsiLowerCaseFileName yes yes
AnsiUpperCaseFileName yes yes
AnsiUpperCase yes yes
LowerCase no no
UpperCase no no
Note: The routines used for string file names: AnsiCompareFileName, AnsiLowerCaseFileName, and AnsiUpperCaseFileName all use the Windows locale. You should always use file names that are portable because the locale (character set) used for file names can and might differ from the default user interface.
String modification routines:
Sub-string routines:
Routine Case-sensitive Supports MBCS
AdjustLineBreaks NA yes
AnsiQuotedStr NA yes
AnsiReplaceStr yes yes
AnsiReplaceText no yes
StringReplace optional by flag yes
ReverseString NA no
StuffString NA no
Trim NA yes
TrimLeft NA yes
TrimRight NA yes
WrapText NA yes
Routine Case-sensitive Supports MBCS
AnsiExtractQuotedStr NA yes
AnsiPos yes yes
IsDelimiter yes yes
IsPathDelimiter yes yes
LastDelimiter yes yes
LeftStr NA no
RightStr NA no
MidStr NA no
QuotedStr no no
---------------------------------------------
Это все что нашел
Здравствуйте, gavrilenko_s, Вы писали:
_>C++ syntax:
_>_>extern PACKAGE AnsiString __fastcall StringReplace(const AnsiString S,
_> const AnsiString OldPattern, const AnsiString NewPattern, TReplaceFlags Flags);
_>
String s = StringReplace(LabeledEdit14->Text,"+","¸",rfReplaceAll);
В чем ошибка?
Разобрался!
StringReplace( ..., TReplaceFlags() << rfReplaceAll << rfIgnoreCase);