Idiomatically determine all the characters that can be used for symbols: Difference between revisions

(GP)
(→‎{{header|Java}}: added Java)
Line 14:
;See also
* [[Idiomatically_determine_all_the_lowercase_and_uppercase_letters|Idiomatically determine all the lowercase and uppercase letters]].
 
=={{header|Java}}==
{{works with|Java|8}}
<lang java>import java.util.stream.IntStream;
 
public class Test {
public static void main(String[] args) throws Exception {
System.out.print("Java Identifier start: ");
IntStream.rangeClosed(0, 0x10FFFF)
.filter(Character::isJavaIdentifierStart)
.limit(72)
.forEach(cp -> System.out.printf("%c", cp));
System.out.println("...");
 
System.out.print("Java Identifier part: ");
IntStream.rangeClosed(0, 0x10FFFF)
.filter(Character::isJavaIdentifierPart)
.limit(25)
.forEach(cp -> System.out.printf("[%d]", cp));
System.out.println("...");
 
System.out.print("Java Identifier ignorable: ");
IntStream.rangeClosed(0, 0x10FFFF)
.filter(Character::isIdentifierIgnorable)
.limit(25)
.forEach(cp -> System.out.printf("[%d]", cp));
System.out.println("...");
 
System.out.print("Unicode Identifier start: ");
IntStream.rangeClosed(0, 0x10FFFF)
.filter(Character::isUnicodeIdentifierStart)
.limit(72)
.forEach(cp -> System.out.printf("%c", cp));
System.out.println("...");
 
System.out.print("Unicode Identifier part: ");
IntStream.rangeClosed(0, 0x10FFFF)
.filter(Character::isUnicodeIdentifierPart)
.limit(25)
.forEach(cp -> System.out.printf("[%d]", cp));
System.out.println("...");
}
}</lang>
 
<pre>Java Identifier start: $ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz¢£¤¥ªµºÀÁÂÃÄÅÆÇÈÉÊ...
Java Identifier part: [0][1][2][3][4][5][6][7][8][14][15][16][17][18][19][20][21][22][23][24][25][26][27][36][48]...
Java Identifier ignorable: [0][1][2][3][4][5][6][7][8][14][15][16][17][18][19][20][21][22][23][24][25][26][27][127][128]...
Unicode Identifier start: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzªµºÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐ...
Unicode Identifier part: [0][1][2][3][4][5][6][7][8][14][15][16][17][18][19][20][21][22][23][24][25][26][27][48][49]...</pre>
 
=={{header|ooRexx}}==
Line 27 ⟶ 76:
{{out}}
<pre>
symbol characters: !.0123456789?ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz </pre>
 
=={{header|PARI/GP}}==
The only symbols that can be used in variable names (including function names as a special case) are a-z, A-Z, 0-9, and the underscore. Additionally, the first character must be a letter. (That is, they must matc hthis regex: <code>[a-zA-Z][a-zA-Z0-9_]*</code>.)
Anonymous user