X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=MojuUtils.pas;h=4c87fb011792ec733405bf2e32ff2d88a2191ea6;hb=refs%2Fheads%2FBb62;hp=71fbd9c3d68db4cc904d751784b658fa1379a406;hpb=601578fea3c3d161c26cb89fcb271393352ee5be;p=gikonavigoeson%2Fgikonavi.git diff --git a/MojuUtils.pas b/MojuUtils.pas index 71fbd9c..4c87fb0 100644 --- a/MojuUtils.pas +++ b/MojuUtils.pas @@ -103,10 +103,10 @@ begin Result := StrPosEx(StrStart, StrEnd, SubstrStart, SubstrEnd); while (Result <> nil) and (StrEnd - Result >= L2) do begin - ByteType := StrByteType(StrStart, Integer(Result-StrStart)); - if (ByteType <> mbTrailByte) and - (CompareString(LOCALE_USER_DEFAULT, SORT_STRINGSORT, Result, L2, SubstrStart, L2) = 2) - then Exit; + ByteType := StrByteType(StrStart, Integer(Result-StrStart)); + if (ByteType <> mbTrailByte) and + (CompareString(LOCALE_USER_DEFAULT, SORT_STRINGSORT, Result, L2, SubstrStart, L2) = 2) + then Exit; if (ByteType = mbLeadByte) then Inc(Result); Inc(Result); Result := StrPosEx(Result, StrEnd, SubStrStart, SubStrEnd); @@ -289,17 +289,26 @@ begin Result := CustomStringReplace(Result, '|', 'b'); end; (************************************************************************* - * –³Œø‚ÈID‚©‚̃`ƒFƒbƒNi–³Œø—áFID:??? , ID:???0) + * –³Œø‚ÈID‚©‚̃`ƒFƒbƒNi–³Œø—áFID:??? , ID:???X) *************************************************************************) function IsNoValidID( inID :String): Boolean; +var + bTail : Boolean; begin + Result := True; inID := Trim(inID); - if inID = '' then Result := True - else begin + if (Length(inID) > 0) then begin inID := Copy(inID, AnsiPos(':', inID) + 1, Length(inID) ); + bTail := False; + // ––”ö‚ª?ˆÈŠO‚© + if Length(inID) > 0 then begin + bTail := (inID[Length(inID)] <> '?'); + end; inID := CustomStringReplace(inID, '?', ''); - if (inID = '') or (inID = '0') then Result := True - else Result := False; + if (Length(inID) > 0) and (not + ((Length(inID) = 1) and (bTail))) then begin + Result := False; + end; end; end; @@ -352,23 +361,31 @@ begin pds := PChar(delimiter); pde := pds + Length(delimiter); - pos := AnsiStrPosEx(pss, pse, pds, pde); + pos := StrPosEx(pss, pse, pds, pde); if pos <> nil then begin p := pos - pss; SetString(Result, pss, p); Delete(s, 1, p + Length(delimiter)); + if (Length(Result) > 0) then begin + if (StrByteType(PChar(Result), Length(Result)-1) = mbLeadByte) then begin + SetLength(Result, Length(Result) - 1); + end; + end; end else begin Result := s; s := ''; end; end; -//! –³ŠQ‰»(& -> & " -> &auot; ‚É•ÏŠ·‚·‚é) + +//! –³ŠQ‰»(& -> & " -> " ‚É•ÏŠ·‚·‚é) function Sanitize(const s: String): String; begin - Result := CustomStringReplace(s, '&', '&'); + // —]•ª‚ɃTƒjƒ^ƒCƒY‚³‚ê‚È‚¢‚悤‚É‚¢‚Á‚½‚ñŒ³‚É–ß‚· + Result := UnSanitize(s); + Result := CustomStringReplace(Result, '&', '&'); Result := CustomStringReplace(Result, '"', '"'); end; -//! –³ŠQ‰»‰ðœ(& -> & &auot; -> " ‚É•ÏŠ·‚·‚é) +//! –³ŠQ‰»‰ðœ(& -> & " -> " ‚É•ÏŠ·‚·‚é) function UnSanitize(const s: String): String; begin Result := CustomStringReplace(s, '"', '"');