티스토리 뷰

Delphi

function StrLIComp(const Str1, Str2: PAnsiChar; MaxLen: Cardinal): Integer;

function StrLIComp(const Str1, Str2: PWideChar; MaxLen: Cardinal): Integer;

C++

extern PACKAGE int __fastcall StrLIComp(const char * Str1, const char * Str2, unsigned MaxLen)/* overload */;

Properties

Type

Visibility

Source

Unit

Parent

function

public

System.SysUtils.pas

System.SysUtils.hpp

System.SysUtils

System.SysUtils

Description

Compares strings up to a specified maximum number of characters, without case sensitivity.

StrLIComp compares Str1 to Str2, up to a maximum length of MaxLen characters, without case sensitivity.

The return value is indicated in the following table.

 

문자열을 지정된 최대 문자 수와 대소문자를 구분하지 않고 비교합니다.

StrLIComp는 대소문자를 구분하지 않고 MaxLen 문자의 최대 길이까지 Str1 Str2를 비교합니다.

반환 값은 다음 표에 나와 있습니다.

 

Return value

Condition

<0

Str1 sorts before Str2.

Str1 Str2보다 먼저 정렬됩니다.

=0

Str1 is the same as Str2.

Str1 Str2와 같습니다.

>0

Str1 sorts after Str2.

Str1 Str2 뒤에 정렬됩니다.

 

 

Note: When working with international characters, use AnsiStrLIComp instead.

참고: 국제 문자로 작업 할 때는 대신 AnsiStrLIComp 를 사용하십시오.

 

Example

var

  Str1, Str2: string;

  PAChar1, PAChar2: PAnsiChar;

begin

  { 케이스 1 }

  Str1 := 'ABC';

  Str2 := 'XYZ';

 

  PAChar1 := Addr(Str1[1]);

  PAChar2 := Addr(Str2[1]);

 

  // 결과: -23

  Writeln(StrLIComp(PAChar1, PAChar2, Length(Str1)));

 

  { 케이스 2 }

  Str1 := 'GG';

  Str2 := 'GG';

 

  PAChar1 := Addr(Str1[1]);

  PAChar2 := Addr(Str2[1]);

 

  // 결과: 0

  Writeln(StrLIComp(PAChar2, PAChar1, Length(Str1)));

 

  { 케이스 3 }

  Str1 := 'FA';

  Str2 := 'HO';

 

  PAChar1 := Addr(Str1[1]);

  PAChar2 := Addr(Str2[1]);

 

  // 결과: 2

  Writeln(StrLIComp(PAChar2, PAChar1, Length(Str1)));

 

  Readln;

end.

 

up to something

1. (특정한 수·정도 등)까지
2. (
특정한 위치·시점)까지
3. (
특정한 기준·수준)만큼

 

출처: http://docwiki.embarcadero.com/Libraries/XE2/en/System.SysUtils.StrLIComp

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함