Delphi copy of the label

for some reason this random switch does not compile

var c: char; begin case c of #32..#33, #35..pred('\'), succ('\')..#255, #256..#65535: ... 

The compiler says: "[DCC Error] poparser.pas (206): E2030 Duplicate shortcut"

I checked it, and SizeOf (c) is 2, Low (c) is 0, High (c) is 65535, which means the ranges should be in order. Then pred ('\') seems to be 91, and succ ('\') seems to be 93, which is also normal. I also commented on other cases, and the result is the same. So what's the problem here?

Here is the complete procedure:

 function String2PO (s:string):string; // Converts a string to the syntax that is used in .po files var i: integer; c: char; escnext:boolean; begin Result := ''; escnext:=False; for i := 1 to length(s) do begin c := s[i]; case c of #32..#33, #35..pred('\'),succ('\')..#255, #256..#65535: begin if escnext then Result:=Result+'\'; Result := Result + c; escnext:=False; end; '\':begin Result:=Result+'\\'; escnext:=False; end; #13:; // Do nothing #10:begin Result := Result + '\n'; escnext:=False; end; #34:begin Result := Result + '\"'; escnext:=False; end; #0:begin Result := Result + '\0'; escnext:=True; end; #9:begin Result:=Result+'\t'; escnext:=False; end; else Result := Result + '\x' + IntToHex(ord(c),2); escnext:=True; end; end; Result := '"' + Result + '"'; end; 

I found out that if I changed the line to

 #32..#33, #35..pred('\'),succ('\')..#65535: 

(removal .. # 255, # 256 ..), then it compiles :)

Note: this is delphi 2009

+7
duplicates case delphi
source share

No one has answered this question yet.

See related questions:

1657
Find duplicate values ​​in SQL table
1194
Remove duplicate values ​​from JS array
1170
How to remove duplicate lines?
856
Delete duplicates in lists
709
How to remove duplicates from the list while maintaining order?
623
Find duplicate records in MySQL
535
SQL Server: CASE WHEN OR THEN ELSE END => OR is not supported
3
Casting Delphi 2009/2010 string literals for PAnsiChar
one
Changed Delphi panel style
one
Why doesn't Delphi 2009 give a message for a constant string that is too long?

All Articles