OSDN Git Service

1.52.1.658
[gikonavigoeson/gikonavi.git] / MojuUtils.pas
index 71fbd9c..fe4aa58 100644 (file)
@@ -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);
@@ -352,16 +352,21 @@ 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 (StrByteType(PChar(Result), Length(Result)-1) = mbLeadByte) then begin
+                       SetLength(Result, Length(Result) - 1);
+               end;
        end else begin
                Result := s;
                s := '';
        end;
 end;
+
 //! \96³\8aQ\89»(& -> &amp; " -> &auot; \82É\95Ï\8a·\82·\82é)
 function Sanitize(const s: String): String;
 begin