首页
\
问答
\
ThreadLocal是否清除为已完成的线程创建的值?(Does ThreadLocal clear values created for already finished threads?)
ThreadLocal是否清除为已完成的线程创建的值?(Does ThreadLocal clear values created for already finished threads?)
ThreadLocal是否自动清除为已完成的线程创建的值?
Does ThreadLocal automatically clear values created for already finished threads?
原文:https://stackoverflow.com/questions/11929173
更新时间:2023-09-16 15:09
最满意答案
我认为你想要
NSDataDetector
,它内置于Cocoa Touch。它有一个子类型
NSTextCheckingTypeAddress
,它将尝试为您解析地址。在示例字符串上使用一个:
NSString * address = @"347 N Canon Dr Beverly Hills, CA 90210"; NSError * err; NSDataDetector * addrParser = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeAddress error:&err]; __block NSDictionary * addressParts; if( addrParser ){ [addrParser enumerateMatchesInString:address options:0 range:(NSRange){0, [address length]} usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) { addressParts = [result addressComponents]; }]; } NSLog(@"%@", addressParts);
生成这本词典:
2014-09-25 20:26:57.747 ParseAddress[56154:60b] { City = "Beverly Hills"; State = CA; Street = "347 N Canon Dr"; ZIP = 90210; }
文档中列出了可能的键。
I think that you want
NSDataDetector
, which is built right in to Cocoa Touch.It has a subtype,
NSTextCheckingTypeAddress
, that will attempt to parse addresses for you.Using one on your example string:
NSString * address = @"347 N Canon Dr Beverly Hills, CA 90210"; NSError * err; NSDataDetector * addrParser = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeAddress error:&err]; __block NSDictionary * addressParts; if( addrParser ){ [addrParser enumerateMatchesInString:address options:0 range:(NSRange){0, [address length]} usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) { addressParts = [result addressComponents]; }]; } NSLog(@"%@", addressParts);
Produces this dictionary:
2014-09-25 20:26:57.747 ParseAddress[56154:60b] { City = "Beverly Hills"; State = CA; Street = "347 N Canon Dr"; ZIP = 90210; }
the possible keys for which are listed in the docs.
相关问答
更多-
地理编码API旨在用于将地址转换为地理坐标。 要查找商家或机构(例如剧院)的位置或地址,您应使用Google Places API。 Places API文本搜索端点将允许您仅使用该企业的名称查询企业的详细信息。 例如: https://maps.googleapis.com/maps/api/place/textsearch/xml?query=Queen%20Elizabeth%20Theatre%20Toronto&key= {yourkeyhere} 要使用API,您需要一个API密钥。 有关从Go ...
-
Google Geocoding v3 - 格式化地址[重复](Google Geocoding v3 - Getting formatted Address [duplicate])[2021-12-15]
function getLatLongDetail(myLatlng) { var geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'latLng': myLatlng }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { ... -
从Google地图获取经过解析且格式正确的地址(Getting a parsed and properly formatted address from Google Maps)[2022-09-18]
我认为你想要NSDataDetector ,它内置于Cocoa Touch。 它有一个子类型NSTextCheckingTypeAddress ,它将尝试为您解析地址。 在示例字符串上使用一个: NSString * address = @"347 N Canon Dr Beverly Hills, CA 90210"; NSError * err; NSDataDetector * addrParser = [NSDataDetector dataDetectorWithTypes:NSTextCheck ... -
使用Geolocation API。 要获取当前位置,可以调用getCurrentPosition()方法。 这将启动异步请求以检测用户的位置,并查询定位硬件以获取最新信息。 确定位置后,执行定义的回调函数。 如果发生错误,您可以选择提供第二个回调函数。 第三个可选参数是一个选项对象,您可以在其中设置返回位置的最大年龄,等待请求的时间以及您希望位置的高精度。 此文档和示例可能对您有所帮助。 Use Geolocation API. To obtain your current location, you c ...
-
Google地图和地址(Google Maps and address)[2022-05-18]
咬, 这很容易做到。 看看我在GitHub上看到的这个小项目,它可以完成你所问的任务: https://github.com/johnfmorton/Get-That-LatLng 这使用Google地图API中的Google地理编码服务: http : //code.google.com/apis/maps/documentation/javascript/services.html#Geocoding 您提供一个地址并返回地图上的点阵列(经度和纬度坐标)。 Nips, This is pretty ea ... -
“dragend”事件比人们预期的更频繁。 我建议你限制这些请求。 添加一个标志,以便一次只有一个服务器请求正在进行中。 如果它本身不起作用(可能不会),则在连续请求之间添加延迟 或者可能添加一个检查以查看用户是否已完成拖动,然后向反向地理编码器执行请求。 The "dragend" event fires way more often than one would expect. I suggest you throttle those requests. add a flag so that only ...
-
我使用这个API大约4年,这很正常。 不幸的是,Google Maps API是一个黑盒子,我们无法做任何事情来修复它,但也许你可以联系他们,这样他们可以为你提供支持 虽然他们给你一个回应,但我会建议你评估你的变量的未定义值,以避免错误 I worked with this API for about 4 years, and this is pretty normal. Unfortunately, the Google Maps API is a black box, we can't do anyth ...
-
从Google Maps API中提取JSON返回的formatted_address(Extract formatted_address from JSON return from Google Maps API)[2022-03-19]
首先,你需要在getCurrentPosition完成后调用api 确保您的api密钥正确并且可以访问地理编码API 从response.data.results [0] .formatted_address访问第一个地址注意我将结果更改为响应,因为它是更具描述性的名称还请注意formatted_address with double t 最后catch在调用之后调用,而不是在setState之后调用 全面的工作示例 componentWillMount() { navigator.geolocatio ... -
您正在寻找地理编码: https : //developers.google.com/maps/documentation/geocoding/ 在这里,您有代码查询谷歌的地址位置,然后在收到的位置指向标记: function initialize() { var mapOptions = { center: new google.maps.LatLng(-34.397, 150.644), zoom: 8, mapTypeId: google.maps.Ma ...
-
当setCenter()失败时,infowindow不会打开。 这是由于在showQrcodes函数中使用的showQrcodes geocoder.geocode()调用的异步性质。 函数setZoom()和setCenter()以及setZoom()打开必须在geocode()成功函数中调用。 我将showQrcodes()函数中的for循环更改for : for (var i = 0; i <= locationArray.length - 1; i++) { coords = new goo ...