我尝试过使用此字符串拆分:
1=10
2=00
3=00.00
返回
s = split("10.00.00.00",'.')
现在我无法理解将最后的结果分成两个不同的行是不可能捕获分隔符' 。 '拆分字符串?
将参数交换到
1=
2=
3=
4=
5=
6=
7=
8=
9=
10=
11=
12=
结果
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.
C:\Users\thufir>cd Desktop
C:\Users\thufir\Desktop>powershell -ExecutionPolicy RemoteSigned
Windows PowerShell
Copyright (C) 2016 Microsoft Corporation. All rights reserved.
PS C:\Users\thufir\Desktop>
PS C:\Users\thufir\Desktop> .\foobar.ps1
TypeName: WebServiceProxy.GlobalWeather
Name MemberType Definition
---- ---------- ----------
Disposed Event System.EventHandler Disposed(System.Object, System.EventArgs)
GetCitiesByCountryCompleted Event WebServiceProxy.GetCitiesByCountryCompletedEventHandler GetCitiesByC...
GetWeatherCompleted Event WebServiceProxy.GetWeatherCompletedEventHandler GetWeatherCompleted(...
Abort Method void Abort()
BeginGetCitiesByCountry Method System.IAsyncResult BeginGetCitiesByCountry(string CountryName, Syst...
BeginGetWeather Method System.IAsyncResult BeginGetWeather(string CityName, string CountryN...
CancelAsync Method void CancelAsync(System.Object userState)
CreateObjRef Method System.Runtime.Remoting.ObjRef CreateObjRef(type requestedType)
Discover Method void Discover()
Dispose Method void Dispose(), void IDisposable.Dispose()
EndGetCitiesByCountry Method string EndGetCitiesByCountry(System.IAsyncResult asyncResult)
EndGetWeather Method string EndGetWeather(System.IAsyncResult asyncResult)
Equals Method bool Equals(System.Object obj)
GetCitiesByCountry Method string GetCitiesByCountry(string CountryName)
GetCitiesByCountryAsync Method void GetCitiesByCountryAsync(string CountryName), void GetCitiesByCo...
GetHashCode Method int GetHashCode()
GetLifetimeService Method System.Object GetLifetimeService()
GetType Method type GetType()
GetWeather Method string GetWeather(string CityName, string CountryName)
GetWeatherAsync Method void GetWeatherAsync(string CityName, string CountryName), void GetW...
InitializeLifetimeService Method System.Object InitializeLifetimeService()
ToString Method string ToString()
AllowAutoRedirect Property bool AllowAutoRedirect {get;set;}
ClientCertificates Property System.Security.Cryptography.X509Certificates.X509CertificateCollect...
ConnectionGroupName Property string ConnectionGroupName {get;set;}
Container Property System.ComponentModel.IContainer Container {get;}
CookieContainer Property System.Net.CookieContainer CookieContainer {get;set;}
Credentials Property System.Net.ICredentials Credentials {get;set;}
EnableDecompression Property bool EnableDecompression {get;set;}
PreAuthenticate Property bool PreAuthenticate {get;set;}
Proxy Property System.Net.IWebProxy Proxy {get;set;}
RequestEncoding Property System.Text.Encoding RequestEncoding {get;set;}
Site Property System.ComponentModel.ISite Site {get;set;}
SoapVersion Property System.Web.Services.Protocols.SoapProtocolVersion SoapVersion {get;s...
Timeout Property int Timeout {get;set;}
UnsafeAuthenticatedConnectionSharing Property bool UnsafeAuthenticatedConnectionSharing {get;set;}
Url Property string Url {get;set;}
UseDefaultCredentials Property bool UseDefaultCredentials {get;set;}
UserAgent Property string UserAgent {get;set;}
<NewDataSet>
<Table>
<Country>Australia</Country>
<City>Archerfield Aerodrome</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Amberley Aerodrome</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Alice Springs Aerodrome</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Brisbane Airport M. O</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Coolangatta Airport Aws</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Cairns Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Charleville Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Gladstone</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Longreach Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Mount Isa Amo</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Mackay Mo</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Oakey Aerodrome</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Proserpine Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Rockhampton Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Broome Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Townsville Amo</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Weipa City</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Gove Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Tennant Creek Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Yulara Aws</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Albury Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Devonport East</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Goldstream Aws</City>
</Table>
<Table>
<Country>Australia</Country>
<City>East Sale Aerodrome</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Hobart Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Launceston Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Laverton Aerodrome</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Moorabbin Airport Aws</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Mount Gambier Aerodrome</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Mildura Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Melbourne Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Macquarie Island</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Wynyard West</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Adelaide Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Albany Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Broken Hill Patton Street</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Ceduna Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Derby</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Darwin Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Bullsbrook Pearce Amo</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Edinburgh M. O.</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Forrest Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Geraldton Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Kalgoorlie Boulder Amo</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Kununurra Kununurra Aws</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Leigh Creek Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Learmonth Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Meekatharra Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Port Hedland Pardoo</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Parafield Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Belmont Perth Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Katherine Aerodrome</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Woomera Aerodrome</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Bankstown Airport Aws</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Canberra</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Coffs Harbour Mo</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Cooma</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Camden Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Dubbo</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Norfolk Island Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Nowra Ran Air Station</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Richmond Aus-Afb</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Sydney Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Tamworth Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Wagga Airport</City>
</Table>
<Table>
<Country>Australia</Country>
<City>Williamtown Aerodrome</City>
</Table>
</NewDataSet>
done
PS C:\Users\thufir\Desktop>
PS C:\Users\thufir\Desktop> type .\foobar.ps1
$url = "http://www.webservicex.net/globalweather.asmx?wsdl"
$webservicex = New-WebServiceProxy -Uri $url -namespace WebServiceProxy -Class GlobalWeatherSoap
$webservicex | gm
echo $australiancities
$australiancities.NewDataSet
$australiancities.NewDataSet.Table
$AustralianCities = $webservicex.GetCitiesByCountry("Australia")
echo $AustralianCities
echo "done"
PS C:\Users\thufir\Desktop>
PS C:\Users\thufir\Desktop>
这是我在stackoverflow上的第一篇文章,请温柔:) 非常感谢任何能指导我完成这项工作的人......这对于一个学校项目来说:)