本文整理汇总了C#中java.lang.String类的典型用法代码示例。如果您正苦于以下问题:C# String类的具体用法?C# String怎么用?C# String使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
String类属于java.lang命名空间,在下文中一共展示了String类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: getDirectoryName
public static String getDirectoryName(String path) {
if (path != null) {
int index = path.lastIndexOf(DIRECTORY_SEPARATOR_CHAR);
int index2 = path.lastIndexOf(ALT_DIRECTORY_SEPARATOR_CHAR);
if (index2 > index) {
index = index2;
}
if (index != -1) {
if (index == path.length() - 1) {
if (path.indexOf(VOLUME_SEPARATOR_CHAR) == index - 1) {
return null;
} else {
path = path.substring(0, index);
}
} else {
if (path.indexOf(VOLUME_SEPARATOR_CHAR) == index - 1) {
path = path.substring(0, index + 1);
} else {
path = path.substring(0, index);
}
}
if (path.length() == 2 && path[1] == VOLUME_SEPARATOR_CHAR) {
return "";
}
}
return path;
}
return null;
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:29,代码来源:PathHelper.stab.cs
示例2: LocalInfo
LocalInfo(TypeInfo type, String name, int index, Label beginLabel, Label endLabel) {
this.type = type;
this.name = name;
this.index = index;
this.beginLabel = beginLabel;
this.endLabel = endLabel;
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:7,代码来源:CodeGenerator.stab.cs
示例3: main
public static void main(String[] args) {
System.out.println();
System.out.println();
var result = new Application().run(args);
System.out.println("Done("+result+")");
System.exit(result);
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:7,代码来源:Application.stab.cs
示例4: buildPackageDocumentation
void buildPackageDocumentation(String packageName, PackageDeclarationNode packageDeclaration) {
var comment = ParserHelper.decodeDocumentation(context.Text, packageDeclaration.DocumentationOffset,
packageDeclaration.DocumentationLength);
memberKind = null;
node = packageDeclaration;
appendDocumentation("N:" + packageName, comment);
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:7,代码来源:DocumentationBuilder.stab.cs
示例5: addLeadingDigitsPattern
public NumberFormat addLeadingDigitsPattern(String value)
{
if (value == null) {
throw new NullPointerException();
}
leadingDigitsPattern_.add(value);
return this;
}
开发者ID:jason-persson,项目名称:LibPhoneNumberPortable,代码行数:8,代码来源:Phonemetadata.cs
示例6: writeFloat
/*
public void writeFloat(float v) {
writeInt(Float.floatToIntBits(v));
}
public void writeDouble(double v) {
writeLong(Double.doubleToLongBits(v));
}
*/
public void writeBytes(String s)
{
int len = s.length();
for (int i = 0 ; i < len ; i++) {
@out.write((byte)s.charAt(i));
}
incCount(len);
}
开发者ID:jason-persson,项目名称:LibPhoneNumberPortable,代码行数:16,代码来源:DataOutputStream.cs
示例7: CodeError
public CodeError(String filename, int id, int level, String message, int line, int column) {
this.Filename = filename;
this.Id = id;
this.Level = level;
this.Message = message;
this.Line = line;
this.Column = column;
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:8,代码来源:CodeErrorManager.stab.cs
示例8: getMessage
public String getMessage(Locale locale, String key, params Object[] args) {
var rb = getResourceBundle(locale);
if (rb != null) {
try {
return MessageFormat.format(rb.getString(key), args);
} catch {
}
}
return key;
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:10,代码来源:ResourceManager.stab.cs
示例9: hasNature
public static bool hasNature(IProject project, String natureId) {
if (project.exists() && project.isOpen()) {
try {
return project.hasNature(natureId);
} catch (CoreException e) {
Environment.logException(e);
}
}
return false;
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:10,代码来源:EclipseHelper.stab.cs
示例10: super
: super(typeSystem, name) {
this.typeSystem = typeSystem;
this.descriptor = "L" + name + ";";
numericTypeKind = TypeKinds[name];
if (numericTypeKind == null) {
numericTypeKind = NumericTypeKind.None;
}
new ClassReader(bytes).accept(new OutlineVisitor(this), ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
this.genericsScope = new Scope<String, TypeInfo>();
this.genericsScope.enterScope();
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:12,代码来源:ClassFileType.stab.cs
示例11: PhoneNumberMatch
/**
* Creates a new match.
*
* @param start the start index into the target text
* @param rawString the matched substring of the target text
* @param number the matched phone number
*/
internal PhoneNumberMatch(int start, String rawString, PhoneNumber number)
{
if (start < 0) {
throw new IllegalArgumentException("Start index must be >= 0.");
}
if (rawString == null || number == null) {
throw new NullPointerException();
}
this._start = start;
this._rawString = rawString;
this._number = number;
}
开发者ID:jason-persson,项目名称:LibPhoneNumberPortable,代码行数:19,代码来源:PhoneNumberMatch.cs
示例12: getInfo
public static MemberInfo getInfo(MethodInfo getAccessor, MethodInfo setAccessor, String name) {
var result = (getAccessor ?? setAccessor).getUserData(typeof(PropertyMemberInfo));
if (result == null) {
result = new PropertyMemberInfo(getAccessor, setAccessor, name);
if (getAccessor != null) {
getAccessor.addUserData(result);
}
if (setAccessor != null) {
setAccessor.addUserData(result);
}
}
return result;
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:13,代码来源:MemberInfo.stab.cs
示例13: getFileName
public static String getFileName(String path) {
if (path != null) {
int index = path.lastIndexOf(DIRECTORY_SEPARATOR_CHAR);
if (index == -1) {
index = path.lastIndexOf(ALT_DIRECTORY_SEPARATOR_CHAR);
}
if (index == -1) {
return path;
}
return path.substring(index + 1);
}
return null;
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:13,代码来源:PathHelper.stab.cs
示例14: addTypeToTypeRelation
public void addTypeToTypeRelation(String referencingType, String referencedType) {
var referencing = referencingTypes.get(referencedType);
if (referencing == null) {
referencing = new HashSet<String>();
referencingTypes[referencedType] = referencing;
}
referencing.add(referencingType);
var referenced = referencedTypes.get(referencingType);
if (referenced == null) {
referenced = new HashSet<String>();
referencedTypes[referencingType] = referenced;
}
referenced.add(referencedType);
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:14,代码来源:DependencyInfo.stab.cs
示例15: addFileToTypeRelation
public void addFileToTypeRelation(String fileName, String typeName) {
var contents = fileContents.get(fileName);
if (contents == null) {
contents = new HashSet<String>();
fileContents[fileName] = contents;
}
contents.add(typeName);
var locations = typeLocations.get(typeName);
if (locations == null) {
locations = new HashSet<String>();
typeLocations[typeName] = locations;
}
locations.add(fileName);
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:14,代码来源:DependencyInfo.stab.cs
示例16: quoteReplacement
public static String quoteReplacement(String s)
{
if ((s.indexOf('\\') == -1) && (s.indexOf('$') == -1))
return s;
StringBuilder sb = new StringBuilder();
for (int i=0; i<s.length(); i++) {
char c = s.charAt(i);
if (c == '\\' || c == '$') {
sb.append('\\');
}
sb.append(c);
}
return sb.toString();
}
开发者ID:jason-persson,项目名称:LibPhoneNumberPortable,代码行数:14,代码来源:Matcher.cs
示例17: testArrays
public void testArrays() {
var c = new Container();
var obj = new Object();
var str = "abc";
var arr = new String[] { "a", "b", "c" };
c.addUserData(obj);
c.addUserData(str);
c.addUserData(arr);
Assert.assertEquals(obj, c.getUserData(typeof(Object)));
Assert.assertEquals("abc", c.getUserData(typeof(String)));
Assert.assertEquals((Object)arr, c.getUserData(typeof(String[])));
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:14,代码来源:UserDataContainerTest.stab.cs
示例18: decodeHexadecimalLong
public static long decodeHexadecimalLong(String value) {
long result = 0;
var ndigits = 0;
for (var i = 2; i < value.length(); i++) {
var digit = ParserHelper.scanHexDigit(value[i]);
if (ndigits == 0 && digit == 0) {
continue;
}
result <<= 4;
result |= digit;
if (++ndigits == 17) {
throw new NumberFormatException(value);
}
}
return result;
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:16,代码来源:ParserHelper.stab.cs
示例19: getFileNameWithoutExtension
public static String getFileNameWithoutExtension(String path) {
if (path != null) {
int index = path.lastIndexOf(DIRECTORY_SEPARATOR_CHAR);
if (index == -1) {
index = path.lastIndexOf(ALT_DIRECTORY_SEPARATOR_CHAR);
}
if (index != -1) {
path = path.substring(index + 1);
}
index = path.lastIndexOf('.');
if (index == -1) {
return path;
}
return path.substring(0, index);
}
return null;
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:17,代码来源:PathHelper.stab.cs
示例20: Library
public Library(String[] classPath, Library parent) {
this.classPath = new ArrayList<String>();
foreach(string path in classPath)
this.classPath.add(path);
this.fileClasses = new HashMap<String, File>(128);
int capacity = (parent == null) ? 0x5000 : 128;
this.jarClasses = new HashMap<String, ZipFile>(capacity);
this.classNames = new ArrayList<String>(capacity);
this.typeInfos = new HashMap<String, TypeInfo>();
this.constructedGenericTypes = new HashMap<TypeInfo, ArrayList<TypeInfo>>();
this.constructedGenericMethods = new HashMap<MethodInfo, ArrayList<MethodInfo>>();
this.parent = parent;
if (parent == null) {
initializeBootClasses();
}
foreach (var path in classPath) {
explorePath(path);
}
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:21,代码来源:Library.stab.cs
注:本文中的java.lang.String类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论