本文整理汇总了C#中System.String.ToLower方法的典型用法代码示例。如果您正苦于以下问题:C# String.ToLower方法的具体用法?C# String.ToLower怎么用?C# String.ToLower使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.String
的用法示例。
在下文中一共展示了String.ToLower方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Match
public InlineLink Match(String word, Brush lBrush, IStatusUpdate oStatusUpdate)
{
if (word == null) return null;
var result =
_acronymSettingsProvider.AcronymMapping.AsParallel().Any(p => p.Acronym.ToLower() == word.ToLower());
if (!result) return null;
var newMeaning =
_acronymSettingsProvider.AcronymMapping.SingleOrDefault(p => p.Acronym.ToLower() == word.ToLower());
if (newMeaning != null)
{
var il = new InlineLink
{
FontFamily = _textProcessorEngine.FfDefault,
FontSize = _textProcessorEngine.FsDefault,
Foreground = _textProcessorEngine.BrText,
FontStyle = FontStyles.Italic,
Text = newMeaning.Meaning,
ToolTip = word
};
return il;
}
else
{
return null;
}
}
示例2: fillForm
public void fillForm(String date, String myOffice, String office, String name, String position, String organisation, String areaCode, String phoneNo, String emailAddress, String additionalInfo, bool optIn, String leadSource)
{
actionHelper.SetTextFieldValue(text_date_locator, date);
if (myOffice.ToLower().Equals("true"))
{
//select client office
actionHelper.ClickWebElement(radio_myOffice_locator);
actionHelper.SetTextFieldValue(text_myOffice_locator, office);
}
else if (myOffice.ToLower().Equals("false"))
{
//select something else
actionHelper.ClickWebElement(radio_msmOffice_locator);
actionHelper.SetDropDownValue(select_office_locator, office);
}
else
{
// select neither location option
}
actionHelper.SetTextFieldValue(text_name_locator, name);
actionHelper.SetTextFieldValue(text_position_locator, position);
actionHelper.SetTextFieldValue(text_organisation_locator, organisation);
actionHelper.SetTextFieldValue(text_areacode_locator, areaCode);
actionHelper.SetTextFieldValue(text_telephonenumber_locator, phoneNo);
actionHelper.SetTextFieldValue(text_email_locator, emailAddress);
actionHelper.SetTextFieldValue(textarea_additionalinformation_locator, additionalInfo);
actionHelper.SetDropDownValue(select_leadsource_locator, leadSource);
actionHelper.SetCheckboxValue(checkbox_emailoptin_locator, optIn);
actionHelper.ClickWebElement(submit_submitmyrequest_locator);
}
示例3: AddIDsToRefresh
public bool AddIDsToRefresh(String ID)
{
if (IDsToRefresh.Contains(ID.ToLower( )))
return false;
IDsToRefresh.Add (ID.ToLower());
return true;
}
示例4: GetHeaderIndex
public int GetHeaderIndex(String headName)
{
if (m_headers.ContainsKey(headName.ToLower()))
return m_headers[headName.ToLower()];
return -1;
}
示例5: search
public List<Contact> search(String search, int index, int nbLines)
{
if (cache.Count > 0)
{
List<Contact> contacts = new List<Contact>();
for (int i = index; i < index + nbLines; i++)
{
Contact contact = new Contact(cache[i]);
//Console.WriteLine(string.Format("{0}", contact.name));
if (contact.name.ToLower().Contains(search.ToLower()))
{
contacts.Add(contact);
}
}
return contacts;
}
else
{
List<Contact> contacts = new List<Contact>();
IEnumerable<string> fileLines = File.ReadLines(dbFileName).Skip(index + 1).Take(10000000);
foreach (string line in fileLines)
{
Contact contact = new Contact(line);
if (contact.name.ToLower().Contains(search.ToLower()))
{
contacts.Add(contact);
}
}
return contacts;
}
}
示例6: RemoveFile
public override void RemoveFile(String path)
{
Stream data = (Stream)_files[path.ToLower()];
data.Close();
data = null;
_files.Remove(path.ToLower());
}
示例7: artistCompare
static Int32 artistCompare(String x, String y)
{
x = (x.ToLower().StartsWith("the ") ? x.ToLower().Replace("the ", "") : x);
y = (y.ToLower().StartsWith("the ") ? y.ToLower().Replace("the ", "") : y);
return x.CompareTo(y);
}
示例8: MakeTinyUrl
private static String MakeTinyUrl(String url)
{
Debug.Assert(!String.IsNullOrEmpty(url), "!String.IsNullOrEmpty(url)");
try
{
if (url.Length <= 30)
{
return url;
}
if (!url.ToLower().StartsWith("http") && !url.ToLower().StartsWith("ftp"))
{
url = String.Format("http://{0}", url);
}
var request = WebRequest.Create(String.Format("http://tinyurl.com/api-create.php?url={0}", url));
var res = request.GetResponse();
var text = "";
using (var reader = new StreamReader(res.GetResponseStream()))
{
text = reader.ReadToEnd();
}
return text;
}
catch (Exception)
{
return url;
}
}
示例9: HasBuff
public static bool HasBuff(this Obj_AI_Base unit, String s)
{
return
unit.Buffs.Any(
a =>
a.Name.ToLower().Contains(s.ToLower()) || a.DisplayName.ToLower().Contains(s.ToLower()));
}
示例10: Match
public InlineLink Match(String word, Brush lBrush, IStatusUpdate oStatusUpdate)
{
if (word == null) return null;
bool result = _websymbols.AsParallel().Any(p => p.Key == word.ToLower());
if (!result) return null;
return _textProcessorEngine.WebSymbolHelper(_websymbols[word.ToLower()], word);
}
示例11: addRecord
/// <summary>
///
/// </summary>
/// <param name="pType"></param>
/// <param name="pRequestedHost"></param>
/// <param name="pRequestedURL"></param>
/// <param name="pReplacementHost"></param>
/// <param name="pReplacementURL"></param>
/// <param name="pReplacementFullPath"></param>
public void addRecord(String pType, String pRequestedHost, String pRequestedURL, String pReplacementHost, String pReplacementURL, String pReplacementFullPath)
{
if (String.IsNullOrEmpty(pType) || (pType.ToLower() != "inject" && pType.ToLower() != "redirect"))
throw new Exception("Something is wrong with the injection type.\r\nPossible values are : inject|redirect");
else if (cDomain.InjectedURLList.Where(s => s.RequestedHost == pRequestedHost && s.RequestedURL == pRequestedURL).Count() > 0)
throw new Exception(String.Format("A record for this URL already exists."));
// Redirect
else if (pType.ToLower().Contains("redirect") && (String.IsNullOrEmpty(pRequestedHost) || String.IsNullOrWhiteSpace(pRequestedHost) || !Regex.Match(pRequestedHost, @"^[\d\w\-_\.]*[\d\w\-_]+\.[\w]{2,10}$").Success))
throw new Exception("Something is wrong with the requested URL.\r\nFormat is : www.facebook.com");
else if (pType.ToLower().Contains("redirect") && (String.IsNullOrEmpty(pRequestedURL) || String.IsNullOrWhiteSpace(pRequestedURL) || !Regex.Match(pRequestedURL, @"^/.*$").Success))
throw new Exception("Something is wrong with the requested URL.\r\nFormat is : /login.php?user=user1");
else if (pType.ToLower().Contains("redirect") && (String.IsNullOrEmpty(pReplacementHost) || String.IsNullOrWhiteSpace(pReplacementHost) || !Regex.Match(pReplacementHost, @"^[\d\w\-_\.]*[\d\w\-_]+\.[\w]{2,10}$").Success))
throw new Exception("Something is wrong with the redirect host name.");
else if (pType.ToLower().Contains("redirect") && (String.IsNullOrEmpty(pReplacementURL) || String.IsNullOrWhiteSpace(pReplacementURL) || !Regex.Match(pReplacementURL, @"^/.*$").Success))
throw new Exception("Something is wrong with the redirected URL.\r\nFormat is : /login.php?user=user1");
// Inject
else if (pType.ToLower().Contains("inject") && pType.ToLower().Contains("inject") && ((String.IsNullOrEmpty(pReplacementURL) || String.IsNullOrWhiteSpace(pReplacementURL))))
throw new Exception("Something is wrong with the injected URL.\r\nFormat is : Your_File_Name.pdf");
else if (pType.ToLower().Contains("inject") && pType.ToLower().Contains("inject") && (!File.Exists(pReplacementFullPath)))
throw new Exception(String.Format("Injection file doesn't exist"));
cDomain.addRecord(new InjectedURLRecord(pType, pRequestedHost, pRequestedURL, pReplacementHost, pReplacementURL, pReplacementFullPath));
}
示例12: ExtractCompressedFile
public static void ExtractCompressedFile(String compressedArchiveName, String destFolder)
{
if (compressedArchiveName.ToLower().EndsWith(".zip"))
{
ExtractZipFile(compressedArchiveName, null, destFolder);
}
else if (compressedArchiveName.ToLower().EndsWith(".tar.gz"))
{
ExtractTGZ(compressedArchiveName, destFolder);
}
else if (compressedArchiveName.ToLower().EndsWith(".gz"))
{
ExtractGZip(compressedArchiveName, destFolder);
}
else
{
string destFile = Path.Combine(destFolder, Path.GetFileName(compressedArchiveName));
// Ensure that the target does not exist
if (File.Exists(destFile))
{
File.Delete(destFile);
}
File.Move(compressedArchiveName, destFile);
}
}
示例13: set_timeout
public static void set_timeout(String timeout_constant)
{
if (timeout_constant.ToLower().Contains("normal")) timeout = 45000;
if (timeout_constant.ToLower().Contains("long")) timeout = 90000;
}
示例14: getUsableDriverName
public static String getUsableDriverName(String rawDriverName, String soundsFolderName)
{
if (!usableNamesForSession.ContainsKey(rawDriverName))
{
String usableDriverName = null;
if (!rawNamesToUsableNamesFileRead)
{
readRawNamesToUsableNamesFile(soundsFolderName);
}
if (lowerCaseRawNameToUsableName.ContainsKey(rawDriverName.ToLower()))
{
usableDriverName = lowerCaseRawNameToUsableName[rawDriverName.ToLower()];
Console.WriteLine("Using mapped drivername " + usableDriverName + " for raw driver name " + rawDriverName);
usableNamesForSession.Add(rawDriverName, usableDriverName);
}
else
{
usableDriverName = validateAndCleanUpName(rawDriverName);
if (usableDriverName != null)
{
Boolean usedLastName = false;
if (useLastNameWherePossible)
{
String lastName = getUnambiguousLastName(usableDriverName);
if (lastName != null && lastName.Count() > 0)
{
if (lowerCaseRawNameToUsableName.ContainsKey(lastName.ToLower()))
{
usableDriverName = lowerCaseRawNameToUsableName[lastName.ToLower()];
Console.WriteLine("Using mapped driver last name " + usableDriverName + " for raw driver last name " + lastName);
usableNamesForSession.Add(rawDriverName, usableDriverName);
usedLastName = true;
}
else
{
Console.WriteLine("Using unmapped driver last name " + lastName + " for raw driver name " + rawDriverName);
usableDriverName = lastName;
usableNamesForSession.Add(rawDriverName, usableDriverName);
usedLastName = true;
}
}
}
if (!usedLastName)
{
Console.WriteLine("Using unmapped drivername " + usableDriverName + " for raw driver name " + rawDriverName);
usableNamesForSession.Add(rawDriverName, usableDriverName);
}
}
else
{
Console.WriteLine("Unable to create a usable driver name for " + rawDriverName);
}
}
return usableDriverName;
}
else
{
return usableNamesForSession[rawDriverName];
}
}
示例15: Import
public QueryResult Import(String location, IGraphDBSession graphDBSession, DBContext myDBContext, UInt32 parallelTasks = 1, IEnumerable<string> comments = null, UInt64? offset = null, UInt64? limit = null, VerbosityTypes verbosityType = VerbosityTypes.Errors)
{
IEnumerable<String> lines = null;
#region Read querie lines from location
try
{
if (location.ToLower().StartsWith(@"file:\\"))
{
lines = ReadFile(location.Substring(@"file:\\".Length));
}
else if (location.ToLower().StartsWith("http://"))
{
lines = ReadHttpResource(location);
}
else
{
return new QueryResult(new Exceptional(new Error_InvalidImportLocation(location, @"file:\\", "http://")));
}
}
catch (Exception ex)
{
return new QueryResult(new Exceptional(new Error_ImportFailed(ex)));
}
#endregion
#region Start import using the AGraphDBImport implementation
return Import(lines, graphDBSession, myDBContext, parallelTasks, comments, offset, limit, verbosityType);
#endregion
}