separator

Escaping separator within double quotes, in awk

时光毁灭记忆、已成空白 提交于 2019-11-26 13:44:48
I am using awk to parse my data with "," as separator as the input is a csv file. However, there are "," within the data which is escaped by double quotes ("..."). Example filed1,filed2,field3,"field4,FOO,BAR",field5 How can i ignore the comma "," within the the double quote so that I can parse the output correctly using awk? I know we can do this in excel, but how do we do it in awk? Dimitre Radoulov It's easy, with GNU awk 4 : zsh-4.3.12[t]% awk '{ for (i = 0; ++i <= NF;) printf "field %d => %s\n", i, $i }' FPAT='([^,]+)|("[^"]+")' infile field 1 => filed1 field 2 => filed2 field 3 => field3

Android: custom separator (or even item) in ListView depening on content of item

非 Y 不嫁゛ 提交于 2019-11-26 12:38:33
问题 I\'ve a ListView with items containing information about places with a rating and the distance to the current location. The items are sorted into groups: Group 1: within 500m Group 2: 500m - 1km Group 3: 1km - 1.5km ... Withing these groups the items are sorted by their rating. Now I put out these items via my custom adapter (extension of BaseAdapter ) into the ListView , which works perfectly. However, what I\'d like to do is to put a separator before the each first item of each group. This

Hide separator line on one UITableViewCell

旧城冷巷雨未停 提交于 2019-11-26 11:58:49
I'm customizing a UITableView . I want to hide the line separating on the last cell ... can i do this? I know I can do tableView.separatorStyle = UITableViewCellStyle.None but that would affect all the cells of the tableView. I want it to only affect my last cell. Hiren in viewDidLoad , add this line: self.tableView.separatorColor = [UIColor clearColor]; and in cellForRowAtIndexPath : for iOS lower versions if(indexPath.row != self.newCarArray.count-1){ UIImageView *line = [[UIImageView alloc] initWithFrame:CGRectMake(0, 44, 320, 2)]; line.backgroundColor = [UIColor redColor]; [cell addSubview

pandas reading CSV data formatted with comma for thousands separator

心已入冬 提交于 2019-11-26 11:38:54
问题 I am trying to create a dataframe in pandas using a CSV that is semicolon-delimited, and uses commas for the thousands separator on numeric data. Is there a way to read this in so that the type of the column is float and not string? 回答1: Pass param thousands=',' to read_csv to read those values as thousands: In [27]: import pandas as pd import io t="""id;value 0;123,123 1;221,323,330 2;32,001""" pd.read_csv(io.StringIO(t), thousands=r',', sep=';') Out[27]: id value 0 0 123123 1 1 221323330 2

Java: join array of primitives with separator

孤街浪徒 提交于 2019-11-26 09:50:27
问题 Suppose, I have an array: int[] arr = new int[] {1, 2, 3, 4, 5, 6, 7}; And I need to join its elements using separator, for example, \" - \" , so as the result I should get string like this: \"1 - 2 - 3 - 4 - 5 - 6 - 7\" How could I do this? PS: yes, I know about this and this posts, but its solutions won\'t work with an array of primitives. 回答1: Here what I came up with. There are several way to do this and they are depends on the tools you using. Using StringUtils and ArrayUtils from Common

Set decimal separator when using f:convertNumber

纵然是瞬间 提交于 2019-11-26 08:33:08
问题 I want to know how to set the default decimal separator on my JSF application. I have some <h:inputText> that I need to format as money, with 2 decimals. Right now the decimal separator used by default is the comma , and this gives me an error when I do some operations on save. I don\'t know if I can set the decimal separator to be used everytime that I use <f:convertNumber> tag. I tried to use this: <f:convertNumber pattern=\"########0.00\" groupingUsed=\"false\" /> but it still sets the

Adding Thousand Separator to Int in Swift

不问归期 提交于 2019-11-26 08:22:02
问题 I am fairly new to Swift and having a great deal of trouble finding a way to add a space as a thousand separator. What I am hoping to achieve is taking the result of a calculation and displaying it in a textfield so that the format is: 2 358 000 instead of 2358000 for example. I am not sure if I should be formatting the Int value and then converting it to a String, or adding the space after the Int value is converted to a String. Any help would be greatly appreciated. 回答1: You can use

Escaping separator within double quotes, in awk

夙愿已清 提交于 2019-11-26 02:38:23
问题 I am using awk to parse my data with \",\" as separator as the input is a csv file. However, there are \",\" within the data which is escaped by double quotes (\"...\"). Example filed1,filed2,field3,\"field4,FOO,BAR\",field5 How can i ignore the comma \",\" within the the double quote so that I can parse the output correctly using awk? I know we can do this in excel, but how do we do it in awk? 回答1: It's easy, with GNU awk 4 : zsh-4.3.12[t]% awk '{ for (i = 0; ++i <= NF;) printf "field %d =>