本文整理汇总了C#中System.String.ToLowerInvariant方法的典型用法代码示例。如果您正苦于以下问题:C# String.ToLowerInvariant方法的具体用法?C# String.ToLowerInvariant怎么用?C# String.ToLowerInvariant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.String
的用法示例。
在下文中一共展示了String.ToLowerInvariant方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindInPath
internal static String FindInPath(String filename)
{
if (string.IsNullOrEmpty(filename))
return string.Empty;
String[] extensions = { "", ".exe", ".com" };
StringBuilder s = new StringBuilder(260); // MAX_PATH
// Step 1: Pre-process the path; if path contains WOW64 folder ref., replace it.
if (Environment.Is64BitProcess && filename.ToLowerInvariant().Contains("sysnative")) {
return filename.ToLowerInvariant().Replace("sysnative", "system32");
}
// Step 2a: If the ref. filename contains extension, use it with no modifications.
if (Path.GetExtension(filename) != string.Empty)
{
IntPtr p = new IntPtr();
SearchPath(null, filename, null, s.Capacity, s, out p);
}
// Step 2b: ... otherwise, iterate through some defaults.
else
{
foreach (String ext in extensions)
{
IntPtr p = new IntPtr();
if (SearchPath(null, String.Concat(filename, ext), null, s.Capacity, s, out p) != 0)
break;
}
}
// Step 3: Return the result.
return (s.Length == 0 ? filename : s.ToString());
}
示例2: PopVariable
public void PopVariable(String name)
{
name = name.ToLowerInvariant();
if (!HasVariable(name)) return;
var list = variables[name.ToLowerInvariant()];
list.RemoveAt(list.Count - 1);
if (list.Count == 0)
variables.Remove(name);
}
示例3: draw
/// <summary>
/// 绘制方法
/// </summary>
/// <param name="graphics"></param>
/// <param name="filePath"></param>
public void draw(Graphics graphics, String filePath)
{
this.graphics = graphics;
filePath = filePath.ToLowerInvariant();
if (filePath.Contains("pot"))
{
reader = new potLoader();
}
else if (filePath.EndsWith("gnt"))
{
reader = new GntLoader();
}
else if (filePath.EndsWith("ptts"))
{
reader = new PttsLoader();
}
else if (filePath.EndsWith("dgr"))
{
reader = new dgrLoader();
}
else if (filePath.EndsWith("newp")|| filePath.EndsWith("txt"))
{
reader = new TEHONLoader();
}
else if (filePath.EndsWith("p"))
{
reader = new pFileLoader();
}
if (reader.load(filePath))
{
this.drawNext();
}
}
示例4: FromString
public static int FromString(String logLevel)
{
int mLogLevel = -1;
if (!String.IsNullOrWhiteSpace(logLevel))
{
switch(logLevel.ToLowerInvariant())
{
case "verbose":
mLogLevel = KeyValues.LOG_LEVEL_VERBOSE;
break;
case "debug":
mLogLevel = KeyValues.LOG_LEVEL_DEBUG;
break;
case "info":
mLogLevel = KeyValues.LOG_LEVEL_INFO;
break;
case "warn":
mLogLevel = KeyValues.LOG_LEVEL_WARN;
break;
case "error":
mLogLevel = KeyValues.LOG_LEVEL_ERROR;
break;
}
}
return mLogLevel;
}
示例5: SendMessageTo
private List<ConnectionEntity> SendMessageTo(String who, String message)
{
//var name = Context.User.Identity.Name;
var name = this.GetConnectionUser();
if (!String.IsNullOrEmpty(name))
{
var table = GetConnectionTable();
// Notice that the partition keys are stored in azure storage as lower case
var query = new TableQuery<ConnectionEntity>()
.Where(TableQuery.GenerateFilterCondition(
"PartitionKey",
QueryComparisons.Equal,
who.ToLowerInvariant()));
var queryResult = table.ExecuteQuery(query).ToList();
if (queryResult.Count == 0)
{
Clients.Caller.showErrorMessage("The user is no longer connected.");
}
else
{
// Load only once the host application connections to display the data there
if(queryResult.Count(o=>o.PartitionKey.Equals(Constants.SignalR_HostApplicationUserName.ToLowerInvariant())) <= 0)
queryResult.AddRange(this.SendMessageTo(Constants.SignalR_HostApplicationUserName, message));
return queryResult;
}
}
return new List<ConnectionEntity>();
}
示例6: Add
public void Add(String name, String value)
{
Guard.ParameterCannotBeNull(name, "name");
name = name.ToLowerInvariant();
_headers.Add(name, value);
Uri uri;
switch (name)
{
case WebSocketHeaders.Origin:
if (String.Equals(value, "null", StringComparison.OrdinalIgnoreCase))
uri = null;
else if (!Uri.TryCreate(value, UriKind.Absolute, out uri))
throw new WebSocketException("Cannot parse '" + value + "' as Origin header Uri");
Origin = uri;
break;
case WebSocketHeaders.Host:
Host = value;
break;
case WebSocketHeaders.Version:
WebSocketVersion = Int16.Parse(value);
break;
}
}
示例7: EncryptCaesar
//EncryptCaesar given the user inputs
public String EncryptCaesar(String Text, int Shift)
{
String EncryptedText = "";
foreach (char c in Text.ToLowerInvariant()) // loop through each character in the text
{
int AsciiCode = (int)c;// change the character to an asciicode
if (AsciiCode >= 97 && AsciiCode <= 122) // check to see if the character is a letter from A-z
{
AsciiCode = AsciiCode + Shift; // add the shift to the asciicode
if (AsciiCode > 122)// if the asciicode is above 122, then the character is greater than Z and needs to restart at A
{
int NewShiftAmount = AsciiCode - 122; // work out what the amount should be added to A
AsciiCode = 96 + NewShiftAmount;// add the newly worked out shift to the asciicode
}
Char NewCharacter = (char)AsciiCode;// transform asciicode to character
EncryptedText = EncryptedText + NewCharacter;// add the newly shifted text to the rest of the different shifts
}
}
//show output to TextBox on gui
Program.writeToConsole("\nInputed Text");
Program.writeToConsole("\n"+ Text);
Program.writeToConsole("\nEncrypted using a "+Shift+ " shift");
Program.writeToConsole("\n"+EncryptedText);
return EncryptedText; // return the newly encrypted text
}
示例8: Filter
public static bool Filter(this String source, String search)
{
if (String.IsNullOrWhiteSpace(source))
{
return false;
}
if (String.IsNullOrWhiteSpace(search))
{
return true;
}
// 不区分大小写
source = source.ToLowerInvariant();
search = search.ToLowerInvariant();
if (source.Contains(search)) return true;
else return false;
//int index = source.IndexOf(search[0]);
//if (index < 0) return false;
//for (short i = 1; i < search.Length; i++)
//{
// char ch = search[i];
// index = source.IndexOf(ch, index + 1);
// if (index < 0)
// {
// return false;
// }
//}
//return true;
}
示例9: GetVaryByCustomString
public override String GetVaryByCustomString(HttpContext context, String custom)
{
custom = custom.ToLowerInvariant();
if (String.Equals(custom, "nm"))
{
return "nm:" + context.User.Identity.Name + ";";
}
else if (String.Equals(custom, "in"))
{
return (context.User.Identity.IsAuthenticated ? "in=t;" : "in=f;");
}
else if (String.Equals(custom, "pm"))
{
return (context.User.IsInRole("ProblemManage") ? "pm=t;" : "pm=f;");
}
else if (String.Equals(custom, "sa"))
{
return (context.User.IsInRole("SuperAdministrator") ? "sa=t;" : "sa=f;");
}
else
{
return base.GetVaryByCustomString(context, custom);
}
}
示例10: GetVariable
public Object GetVariable(String name)
{
name = name.ToLowerInvariant();
if (name == "@parent") return parentScope;
if (!HasVariable(name)) return null;
var list = variables[name];
return list[list.Count - 1];
}
示例11: ImplementationKey
/// <summary>
/// Initialize a new instance of the <see cref="ImplementationKey"/> struct.
/// </summary>
/// <param name="fileName">The configuration file name.</param>
/// <param name="applicationName">The application name.</param>
/// <param name="enableGroupPolicies">true to enable Group Policy; otherwise, false.</param>
public ImplementationKey(String fileName,
String applicationName,
Boolean enableGroupPolicies)
{
FileName = fileName != null ? fileName.ToLowerInvariant() : null;
ApplicationName = applicationName != null ? applicationName.ToLowerInvariant() : null;
EnableGroupPolicies = enableGroupPolicies;
}
示例12: ChangeVariable
public void ChangeVariable(String name, Object newValue)
{
name = name.ToLowerInvariant();
if (!variables.ContainsKey(name))
throw new ScriptError("Variable does not exist.", null);
var list = variables[name];
list.RemoveAt(list.Count - 1);
list.Add(newValue);
}
示例13: IsValid
/// <summary>
/// Wrapper function for recursive call to search for Acronym validation. The acronym must contain at
/// least 1 letter from each word in the Product Name List and the letters must be in order of the Product Name.
/// </summary>
/// <param name="acronym">Acronym needing validation</param>
/// <param name="productName">Product Name List</param>
/// <returns>True if the acronym is valid for the Product List.</returns>
public static Boolean IsValid(String acronym, List<String> productName )
{
Int32 partCount = 0;
String lcAcronym = acronym.ToLowerInvariant();
List<String> productPartsRequired = new List<String>();
//Test for the null cases
if (productName.Count == 0)
throw new ArgumentException("Empty product name. Product must exist.");
if (productName.Count >=0 && productName.Contains(String.Empty) )
throw new ArgumentException("Empty product name. Product must exist.");
if (acronym == String.Empty)
throw new ArgumentException("Empty acronym specified. Acronym must include letters");
if (acronym.Length < productName.Count)
return false;
//Push the product name list ot the lowercase equivalient
foreach (var product in productName)
{
productPartsRequired.Add(product.ToLowerInvariant());
}
if(!productPartsRequired[0].Contains(lcAcronym[0]) )
return false;
//Determine if the acronym parts are contained within every word of the Product name or
//if the parts contain the complete acronym. If so return valid otherwise start seeking paths.
foreach (String part in productName)
{
if (part.ToLowerInvariant().Contains(acronym.ToLowerInvariant()) || acronym.ToLowerInvariant().Contains(part.ToLowerInvariant()))
partCount++;
}
if (partCount == productName.Count)
return true;
return Validation( lcAcronym, productPartsRequired, 0, 0, 0);
}
示例14: LoadChampion
public static void LoadChampion(String Name)
{
switch (Name.ToLowerInvariant())
{
case "cassiopeia":
new Instance.Cassiopeia();
break;
default:
new Instance.Orbwalker();
break;
}
}
示例15: Create
public static ReplyConfiguration Create(String exchangeType, String exchangeName, String routingKey)
{
switch (exchangeType.ToLowerInvariant())
{
case "direct":
return new DirectReplyConfiguration(exchangeName, routingKey);
case "topic":
return new TopicReplyConfiguration(exchangeName, routingKey);
case "fanout":
return new FanoutReplyConfiguration(exchangeName);
}
throw new ArgumentException($"Exchange type not recognized: {exchangeType}");
}