Java Unicode variable names

前端 未结 2 1927
深忆病人
深忆病人 2020-12-03 17:34

I got into an interesting discussion in a forum where we discussed the naming of variables.

Conventions aside, I noticed that it is legal for a variable to have the

2条回答
  •  一向
    一向 (楼主)
    2020-12-03 17:42

    Unicode characters fall into character classes. There's a set of Unicode characters which fall into the class "letter".

    Determined by Character.isLetter(c) for Java. But for identifiers, Character.isJavaIdentifierStart(c) and Character.isJavaIdentifierPart(c) are more relevant.

    For the relevant Unicode spec, see this.

提交回复
热议问题