本文整理汇总了C#中java.lang.String.equals方法的典型用法代码示例。如果您正苦于以下问题:C# String.equals方法的具体用法?C# String.equals怎么用?C# String.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang.String
的用法示例。
在下文中一共展示了String.equals方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getMembers
public Iterable<MemberInfo> getMembers(String identifier) {
if (identifier.equals("this")) {
return getMembers();
} else if (identifier.equals("super")) {
var type = typeInfos[typeInfos.size() - 1];
return getMembers(type.BaseType, false);
}
var members = new HashMap<String, MemberInfo>();
putTypeMembers(members);
var type = typeInfos[typeInfos.size() - 1];
foreach (var t in type.getBaseTypes().reverse()) {
putFields(t, members);
putProperties(t, members);
putNestedTypes(t, members);
}
putFields(type, members);
putProperties(type, members);
putNestedTypes(type, members);
putLocals(members);
var member = members[identifier];
if (member == null) {
return Query.empty();
}
return getMembers(member.Type, (member.MemberKind == MemberKind.Local) ? false : member.IsStatic);
}
示例2: visitInnerClass
public void visitInnerClass(String name, String outerName, String innerName, int access) {
if (!name.equals(classFileType.FullName)) {
// Inner classes with outerName == null are method classes: ignore them.
if (outerName != null && outerName.equals(classFileType.FullName)) {
var nestedType = (ClassFileType)classFileType.typeSystem.getType(name);
nestedType.nestedModifiers = access;
nestedType.declaringType = classFileType;
classFileType.nestedTypes.add(nestedType);
}
}
}
示例3: getMembers
public static Iterable<MemberInfo> getMembers(Library typeSystem, TypeInfo type, String name) {
var result = new ArrayList<MemberInfo>();
foreach (var f in type.Fields) {
if (f.Name.equals(name)) {
result.add(MemberInfo.getInfo(f));
break;
}
}
MethodInfo getAccessor = null;
MethodInfo setAccessor = null;
foreach (var m in type.Methods) {
if (getAccessor == null || setAccessor == null) {
foreach (var annotation in BytecodeHelper.getAnnotations(typeSystem, m)) {
if (BytecodeHelper.isPropertyGet(annotation) && name.equals(BytecodeHelper.getPropertyGetName(m, annotation))) {
getAccessor = m;
break;
}
if (BytecodeHelper.isPropertySet(annotation) && name.equals(BytecodeHelper.getPropertySetName(m, annotation))) {
setAccessor = m;
break;
}
}
}
if (m.Name.equals(name)) {
result.add(MemberInfo.getInfo(m));
}
}
if (getAccessor != null || setAccessor != null) {
result.add(MemberInfo.getInfo(getAccessor, setAccessor, name));
}
foreach (var t in type.NestedTypes) {
if (name.equals(t.Name)) {
result.add(MemberInfo.getInfo(t));
break;
}
}
return result;
}
示例4: mayFallBackToEnglish
private boolean mayFallBackToEnglish(String lang)
{
// Don't fall back to English if the requested language is among the following:
// - Chinese
// - Japanese
// - Korean
return !lang.equals("zh") && !lang.equals("ja") && !lang.equals("ko");
}
示例5: getRegionDisplayName
/**
* Returns the customary display name in the given language for the given region.
*/
private String getRegionDisplayName(String regionCode, Locale language)
{
return (regionCode == null || regionCode.equals("ZZ") ||
regionCode.equals(PhoneNumberUtil.REGION_CODE_FOR_NON_GEO_ENTITY))
? "" : new Locale("", regionCode).getDisplayCountry(language);
}
示例6: getDescriptionForValidNumber
/**
* As per {@link #getDescriptionForValidNumber(PhoneNumber, Locale)} but also considers the
* region of the user. If the phone number is from the same region as the user, only a lower-level
* description will be returned, if one exists. Otherwise, the phone number's region will be
* returned, with optionally some more detailed information.
*
* <p>For example, for a user from the region "US" (United States), we would show "Mountain View,
* CA" for a particular number, omitting the United States from the description. For a user from
* the United Kingdom (region "GB"), for the same number we may show "Mountain View, CA, United
* States" or even just "United States".
*
* <p>This method assumes the validity of the number passed in has already been checked.
*
* @param number the phone number for which we want to get a text description
* @param languageCode the language code for which the description should be written
* @param userRegion the region code for a given user. This region will be omitted from the
* description if the phone number comes from this region. It is a two-letter uppercase ISO
* country code as defined by ISO 3166-1.
* @return a text description for the given language code for the given phone number, or empty
* string if the number passed in is invalid
*/
public String getDescriptionForValidNumber(PhoneNumber number, Locale languageCode,
String userRegion)
{
// If the user region matches the number's region, then we just show the lower-level
// description, if one exists - if no description exists, we will show the region(country) name
// for the number.
String regionCode = phoneUtil.getRegionCodeForNumber(number);
if (userRegion.equals(regionCode)) {
return getDescriptionForValidNumber(number, languageCode);
}
// Otherwise, we just show the region(country) name for now.
return getRegionDisplayName(regionCode, languageCode);
// TODO: Concatenate the lower-level and country-name information in an appropriate
// way for each language.
}