character

Count characters in field dynamically

谁说胖子不能爱 提交于 2019-12-22 11:14:09
问题 I would like to count characters in a form textarea field dynamically, I know there is a similar question about this but I am wondering if it can count from a certain number towards 0, as example while writing a tweet on Twitter. This code could be in javascript, PHP, it doesn't really matter to me. 回答1: This should help you out. Here is a tutorial regarding usage - a demo is found below: Usage: <input name="text" onKeyDown="CountLeft(this.form.text, this.form.left,50);" onKeyUp="CountLeft

How to call (dialing) with “ * ” char in IOS?

亡梦爱人 提交于 2019-12-22 11:07:34
问题 I hope to call with * character. ex> *711313. Currently, I'm using this code: NSString *str = [NSString stringWithFormat:@"tel:%@", tmp]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]; I tested two cases: tmp = @"719929292"; //this is ok. make call. tmp = @"*7128282"; //app no reaction. not to call. How can I call with *(star character)? 回答1: The star may have to be encoded for use in a URL. Try %2A

in Swift how do I interleave NSMutableParagraphStyle() and NSMutableAttributedString to format a string to be displayed in UITextView?

梦想的初衷 提交于 2019-12-22 10:07:05
问题 In response to an example I posted previously, Andreas Oetjen showed a neat way to display a table of fractional and decimal numbers in textView using attributed strings aligning numbers so the decimal point or forward slash characters appear in the same column as shown in Example 1 below . With that introduction to attributed strings I was prompted to ask: how to display each column in a different colour or font ? ( to associate data with file types found elsewhere in the app ) When I try to

Prevent grep in R from treating “.” as a letter

孤者浪人 提交于 2019-12-22 09:11:53
问题 I have a character vector that contains text similar to the following: text <- c("ABc.def.xYz", "ge", "lmo.qrstu") I would like to remove everything before a . : > "xYz" "ge" "qrstu" However, the grep function seems to be treating . as a letter: pattern <- "([A-Z]|[a-z])+$" grep(pattern, text, value = T) > "ABc.def.xYz" "ge" "lmo.qrstu" The pattern works elsewhere, such as on regexpal. How can I get grep to behave as expected? 回答1: grep is for finding the pattern. It returns the index of the

regex to also match accented characters

只愿长相守 提交于 2019-12-22 08:11:04
问题 I have the following PHP code: $search = "foo bar que"; $search_string = str_replace(" ", "|", $search); $text = "This is my foo text with qué and other accented characters."; $text = preg_replace("/$search_string/i", "<b>$0</b>", $text); echo $text; Obviously, "que" does not match "qué". How can I change that? Is there a way to make preg_replace ignore all accents? The characters that have to match (Spanish): á,Á,é,É,í,Í,ó,Ó,ú,Ú,ñ,Ñ I don't want to replace all accented characters before

How can I create a CSV file with PHP that preserves the Japanese characters?

陌路散爱 提交于 2019-12-22 07:01:57
问题 Below is my code snippet for creating and downloading the CSV file from the browser. $input_array[] = ['注文日時', '受注番号',]; $input_array[] = ['2015-09-30', 'INV-00001',]; /** open raw memory as file, no need for temp files, be careful not to run out of memory thought */ $f = fopen('php://memory', 'w'); /** loop through array */ foreach ($input_array as $line) { /** default php csv handler **/ fputcsv($f, $line, ','); } /** rewrind the "file" with the csv lines **/ fseek($f, 0); /** modify header

How to display hidden characters in PhpStorm, especially line seperators

岁酱吖の 提交于 2019-12-22 06:37:00
问题 I got some special characters in my codes, take a look at: 
 a


 
 
 It's just shown in frontend with normal characters like an "a". Now the same characters without any normal characters: Characters starts here 




 Characters ends here Ok it looks like this Editor will not save empty 
 , try it with snippet. <html><p>
 </p></html> The problem is, in PhpStorm this characters wont be shown, even not with "settings - Editor - General - Appearance - show whitespaces" or "settings - Editor -

How to count grapheme clusters or “perceived” emoji characters in Java

只谈情不闲聊 提交于 2019-12-22 05:25:21
问题 I'm looking to count the number of perceived emoji characters in a provided Java string. I'm currently using the emoji4j library, but it doesn't work for grapheme clusters like this one: 👩‍👩‍👦‍👦 Calling EmojiUtil.getLength("👩‍👩‍👦‍👦") returns 4 instead of 1 , and similarly calling EmojiUtil.getLength("👻👩‍👩‍👦‍👦") returns 5 instead of 2 . Are there any APIs or methods on String in Java that make it easy to count grapheme clusters? I've been hunting around but understandably the codePoints()

regular expression to add characters before and after numbers

我怕爱的太早我们不能终老 提交于 2019-12-22 03:48:25
问题 I have a list of numbers between square brackets, and I need to add words before and after the exact numbers (i.e. keep the same numbers). I use notepad++ to replace, but if you have a solution with other program please advise. Example: text [121] othertext moretext [16] othertextmore andtext [5940] othertextplus outcome: text xxxxxxxxx [121] xxxxxxxxx othertext moretext xxxxxxxxx [16] xxxxxxxxx othertextmore andtext xxxxxxxxx [5940] xxxxxxxxx othertextplus The numbers are of course \d+ but I

Breaking down a Hangul syllable into letters (jamo)

谁说胖子不能爱 提交于 2019-12-22 01:17:29
问题 I'm working on a program that deals with Korean sentences and I need a way to break down a syllable, or block, into its letters. For those who don't know Hangul, a syllable is composed of 2-4 letters (jamo), creating thousands of different combinations. What I'd like to do is break down those syllables into the letters that form it. I was able to get the first letter by comparing its Unicode value to the associated letter in that range, i.e. a syllable that starts with x letter is in y range.