Home HomeHarry Eric L Strzec i bronic (SCAN dal 714)Teach yourself linux in 24 hoursJan Potocki Rekopis znaleziony w SragossieMakuszynski Kornel Po mlecznej drodze (SCAN dal 10Harry Harrison Stalowy Szczur idzie do wojska252317758 Curso de Processo Penal Fernando Capez 2014Anne McCaffrey Smocze werble (2)Vonnegut Kurt Galapagos (2)Pawlowski A. Metody kwantytywneEco Umberto Baudolino
  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • mostlysunny.pev.pl
  •  

    [ Pobierz całość w formacie PDF ]
    ." 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 ordinalvalues of the characters.If the routine is case-insensitive, there is a logical mergingof upper and lower case characters that is determined by a predefined pattern.Common pr ogr ammi ng t as k s 4-43 Wo r k i n g wi t h s t r i n g s" Uses locale settings: Locale settings allow you to customize your application forspecific locales, in particular, for Asian language environments.Most localesettings consider lowercase characters to be less than the corresponding uppercasecharacters.This is in contrast to ASCII order, in which lowercase characters aregreater than uppercase characters.Routines that use the Windows locale aretypically prefaced with Ansi (that is, AnsiXXX)." Supports the multi-byte character set (MBCS): MBCSs are used when writing codefor far eastern locales.Multi-byte characters are represented as a mix of one- andtwo-byte character codes, so the length in bytes does not necessarily correspond tothe length of the string.The routines that support MBCS are written parse one-and two-byte characters.ByteType and StrByteType determine whether a particular byte is the lead byte of atwo-byte character.Be careful when using multi-byte characters not to truncate astring by cutting a two-byte character in half.Do not pass characters as a parameterto 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 aboutMBCS, see  Enabling application code on page 12-2 of Chapter 12,  Creatinginternational applications.Table 4.3 String comparison routinesRoutine Case-sensitive Uses locale settings Supports MBCSAnsiCompareStr yes yes yesAnsiCompareText no yes yesAnsiCompareFileName no yes yesCompareStr yes no noCompareText no no noTable 4.4 Case conversion routinesRoutine Uses locale settings Supports MBCSAnsiLowerCase yes yesAnsiLowerCaseFileName yes yesAnsiUpperCaseFileName yes yesAnsiUpperCase yes yesLowerCase no noUpperCase no noThe routines used for string file names: AnsiCompareFileName,AnsiLowerCaseFileName, and AnsiUpperCaseFileName all use the Windows locale.Youshould always use file names that are portable because the locale (character set) usedfor file names can and might differ from the default user interface.4-44 Devel oper  s Gui de Wo r k i n g wi t h s t r i n g sTable 4.5 String modification routinesRoutine Case-sensitive Supports MBCSAdjustLineBreaks NA yesAnsiQuotedStr NA yesStringReplace optional by flag yesTrim NA yesTrimLeft NA yesTrimRight NA yesWrapText NA yesTable 4.6 Sub-string routinesRoutine Case-sensitive Supports MBCSAnsiExtractQuotedStr NA yesAnsiPos yes yesIsDelimiter yes yesIsPathDelimiter yes yesLastDelimiter yes yesQuotedStr no noTable 4.7 String handling routinesRoutine Case-sensitive Supports MBCSAnsiContainsText no yesAnsiEndsText no noAnsiIndexText no yesAnsiMatchText no yesAnsiResemblesText no noAnsiStartsText no yesIfThen NA yesLeftStr yes noRightStr yes noSoundEx NA noSoundExInt NA noDecodeSoundExInt NA noSoundExWord NA noDecodeSoundExWord NA noSoundExSimilar NA noSoundExCompare NA noCommon pr ogr ammi ng t as k s 4-45 Wo r k i n g wi t h s t r i n g sDeclaring and initializing stringsWhen you declare a long string:S: string;you do not need to initialize it.Long strings are automatically initialized to empty.Totest a string for empty you can either use the EmptyStr variable:S = EmptyStr;or test against an empty string:S =   ;An empty string has no valid data.Therefore, trying to index an empty string is liketrying to access nil and will result in an access violation:varS: string;beginS[i]; // this will cause an access violation// statementsend;Similarly, if you cast an empty string to a PChar, the result is a nil pointer.So, if youare passing such a PChar to a routine that needs to read or write to it, be sure that theroutine can handle nil:varS: string; // empty stringbeginproc(PChar(S)); // be sure that proc can handle nil// statementsend;If it cannot, then you can either initialize the string:S :=  No longer nil ;proc(PChar(S));// proc does not need to handle nil nowor set the length, using the SetLength procedure:SetLength(S, 100);//sets the dynamic length of S to 100proc(PChar(S));// proc does not need to handle nil nowWhen you use SetLength, existing characters in the string are preserved, but thecontents of any newly allocated space is undefined.Following a call to SetLength, S isguaranteed to reference a unique string, that is a string with a reference count of one.To obtain the length of a string, use the Length function.Remember when declaring a string that:S: string[n];implicitly declares a short string, not a long string of n length.To declare a long stringof specifically n length, declare a variable of type string and use the SetLengthprocedure.S: string;SetLength(S, n);4-46 Devel oper  s Gui de Wo r k i n g wi t h s t r i n g sMixing and converting string typesShort, long, and wide strings can be mixed in assignments and expressions, and thecompiler automatically generates code to perform the necessary string typeconversions.However, when assigning a string value to a short string variable, beaware that the string value is truncated if it is longer than the declared maximumlength of the short string variable.Long strings are already dynamically allocated [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • syriusz777.pev.pl
  •