我有一个输入csv文件,其中的列包含类似于以下示例的信息:
805265
995874
805674
984654
332574
339852
Run Code Online (Sandbox Code Playgroud)
我想基于前2个字符将唯一值提取到数组中,因此使用上面的示例我的结果将是:
80,99,98,33
我如何使用PowerShell实现这一目标?
我有一些类似的代码:
HttpWebRequest req;
HttpWebResponse response;
Stream receiveStream = null;
StreamReader readStream = null;
try
{
req = (HttpWebRequest)WebRequest.Create("someUrl"));
req.Credentials = CredentialCache.DefaultCredentials;
req.Method = "GET";
response = (HttpWebResponse)req.GetResponse();
receiveStream = response.GetResponseStream();
readStream = new StreamReader(receiveStream, Encoding.Default);
return readStream.ReadToEnd();
}
catch
{
return "Error";
}
finally
{
readStream = null;
receiveStream = null;
response = null;
req = null;
}
Run Code Online (Sandbox Code Playgroud)
此代码是否应该具有readStream.Dispose()和responseStream.Dispose()而不是将它们都设置为null?
在 iOS13 发布之后,我正在使用 Cordova 测试混合应用程序。启动相机非常慢,并生成以下内容:
================================================== ================
主线程检查器:在后台线程上调用的 UI API:-[UIImagePickerController init]
PID:1347,TID:618928,线程名称:(无),队列名称:com.apple.root.default-qos,QoS:0
回溯:
4 0x0000000100f1bba0 +[CDVCameraPicker createFromPictureOptions:] + 124
5 0x0000000100f15d54 -[CDVCamera showCameraPicker:withOptions:] + 108
6 0x0000000100f15570 __25-[CDVCamera takePicture:]_block_invoke_2 + 336
7 AVFoundation 0x00000001b76178f8 2BC0C357-314E-3AE8-B006-C28528B87512 + 710904
8 TCC 0x00000001b35dfbf8 85A762AF-99DB-3B4C-B24B-09600CC17196 + 7160
9 TCC 0x00000001b35e3de4 85A762AF-99DB-3B4C-B24B-09600CC17196 + 24036
10 libxpc.dylib 0x00000001acfe3804 79A1F1AD-9CB4-3334-91D9-E1ED6B1032A3 + 104452
11 libxpc.dylib 0x00000001acfd72c4 79A1F1AD-9CB4-3334-91D9-E1ED6B1032A3 + 53956
12 libdispatch.dylib 0x000000010109b3b4 _dispatch_client_callout3 + 20
13 libdispatch.dylib 0x00000001010b7000 _dispatch_mach_msg_async_reply_invoke + 392
14 libdispatch.dylib 0x00000001010ada8c _dispatch_kevent_worker_thread + 1436
15 …