2012-09-11 17:25:53
Responsive web design continues to become more widely practiced. Because of that, as web developers ...
+ развернуть текстсохранённая копия
Responsive web design continues to become more widely practiced. Because of that, as web developers and designers, I have more tools and resources that make it easier for us to create responsive web...
[[ Das ist nur ein Auszug. Besuchen Sie meine Webseite, um Links, weitere Inhalte und mehr zu erhalten! ]]
Есть несколько путей определить содержит ли строка специальные символы. В этом примере я покажу быстрый способ определения спец. символов с использованием регулярных выражений (Regex).
C#
static void Main(string[] args) { string str = "Th!s $tri^g c@n$ist $pecial ch@rs"; Match match = Regex.Match(str, "[^a-z0-9]", RegexOptions.IgnoreCase); while (match.Success) { string key = match.Value; Console.Write(key); match = match.NextMatch(); } Console.ReadLine(); }
VB. NET
Shared Sub Main(ByVal args() As String) Dim str As String = "Th!s $tri^g c@n$ist $pecial ch@rs" Dim match As Match = Regex.Match(str, "[^a-z0-9]", _ RegexOptions.IgnoreCase) Do While match.Success Dim key As String = match.Value Console.Write(key) match = match.NextMatch() Loop Console.ReadLine() End Sub
Метод Regex.Match()
ищет во входной строке первое вхождение подстроки специфицированной с помощью регулярного выражения. Свойство Success (успех) объекта Match говорит нам о том, что шаблон регулярного выражения подошел к чему-то внутри входной строки.
Если это случилось, то в примере печатается первое совпадение и затем вытаскивается следующие повторными вызовами Match.NextMatch метода.
Здесь будет написано как программно определить, какая Windows установлена на компьютере где запущена программа.
Для этого мы используем
ManagementObjectSearcher
класс здесь.
C#
using System; using System.Management;
namespace ConsoleApplication1 { class Program { public static void Main() { string winos = "Select Name from Win32_OperatingSystem"; ManagementObjectSearcher mos = new ManagementObjectSearcher(winos); foreach (ManagementObject mo in mos.Get()) { Console.WriteLine("OS Name: {0}", mo["Name"]); } Console.ReadLine(); } } }
VB.NET
Imports System Imports System.Management
Namespace ConsoleApplication1 Friend Class Program Public Shared Sub Main() Dim winos As String = "Select Name from Win32_OperatingSystem" Dim mos As New ManagementObjectSearcher(winos) For Each mo As ManagementObject In mos.Get() Console.WriteLine("OS Name: {0}", mo("Name")) Next mo Console.ReadLine() End Sub End Class End Namespace
В этом примере WMI класс Win32_OperatingSystem предсталяет из себя Windows-based операционную систему установленную на компьютере.
2012-09-07 19:44:54
... with WordPress, theme frameworks and starter themes ... of efficiency. Frameworks and starter themes ...
+ развернуть текстсохранённая копия
For designers and developers that frequently work with WordPress, theme frameworks and starter themes can have a noticeable impact of efficiency. Frameworks and starter themes can eliminate some of...
[[ Das ist nur ein Auszug. Besuchen Sie meine Webseite, um Links, weitere Inhalte und mehr zu erhalten! ]]