English 中文(简体)
如何在死者分离之前插入1 000名分离器
原标题:How to insert thousand separators only before the decimal separator

我利用这一规章,将数千个分离者置于地狱中:

while matchstr(mystr,  (d)(d{3})(D|s|$) ) !=   
    let mystr = substitute(mystr,  (d)(d{3})(D|s|$) ,  1.23 ,  g )
endwhile

页: 1

let mystr =  2000000 

上述法典

2.000.000

问题在于有一位精子的分离者,它还把几千名分离者放在离奇马尔的分离者(下称 com)之后的一小部分。

页: 1 example,

let mystr =  2000000,2346 

导致

2.000.000,2.346

而我却希望

2.000.000,2346

I tried to adapt the above code but didn t find a satisfiable solution. Can anyone help me?

最佳回答

Use the following call to the substitute() function instead of the whole loop listed in the question.

substitute(s,  (d,d*)@<!dze(d{3})+d@! ,  &. ,  g )
问题回答

www.un.org/spanish/ecosoc Try this (work for positive integer only):

<>http://europa-eu>

(?<=[0-9])(?=(?:[0-9]{3})+(?![0-9]))

<>Replace with

,

I ve not tried over vim whether it would work or not. But the pattern is PCRE compatible.


<>Explanation>

<!--
(?<=[0-9])(?=(?:[0-9]{3})+(?![0-9]))

Options: case insensitive; ^ and $ match at line breaks

Assert that the regex below can be matched, with the match ending at this position (positive lookbehind) «(?<=[0-9])»
   Match a single character in the range between “0” and “9” «[0-9]»
Assert that the regex below can be matched, starting at this position (positive lookahead) «(?=(?:[0-9]{3})+(?![0-9]))»
   Match the regular expression below «(?:[0-9]{3})+»
      Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
      Match a single character in the range between “0” and “9” «[0-9]{3}»
         Exactly 3 times «{3}»
   Assert that it is impossible to match the regex below starting at this position (negative lookahead) «(?![0-9])»
      Match a single character in the range between “0” and “9” «[0-9]»
-->




相关问题
Simple JAVA: Password Verifier problem

I have a simple problem that says: A password for xyz corporation is supposed to be 6 characters long and made up of a combination of letters and digits. Write a program fragment to read in a string ...

Case insensitive comparison of strings in shell script

The == operator is used to compare two strings in shell script. However, I want to compare two strings ignoring case, how can it be done? Is there any standard command for this?

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

String initialization with pair of iterators

I m trying to initialize string with iterators and something like this works: ifstream fin("tmp.txt"); istream_iterator<char> in_i(fin), eos; //here eos is 1 over the end string s(in_i, ...

break a string in parts

I have a string "pc1|pc2|pc3|" I want to get each word on different line like: pc1 pc2 pc3 I need to do this in C#... any suggestions??

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签