character

How do I used a char as the case in a switch-case?

大城市里の小女人 提交于 2020-01-02 01:20:10
问题 How do I use a character in a switch-case? I will be getting the first letter of whatever the user inputs. import javax.swing.*; public class SwitCase { public static void main (String[] args){ String hello=""; hello=JOptionPane.showInputDialog("Input a letter: "); char hi=hello; switch(hi){ case 'a': System.out.println("a"); } } } 回答1: public class SwitCase { public static void main (String[] args){ String hello = JOptionPane.showInputDialog("Input a letter: "); char hi = hello.charAt(0); /

Some of the outputs from cygwin just can not be read with bad encoding?

元气小坏坏 提交于 2020-01-01 19:03:10
问题 I'm using cygwin on Win7-64bit, and with "zh_CN.UTF-8" as default locale setting. Occasionally, some of the outputs from cygwin just can not be read with bad encoding like follows: [junit] ▒▒▒▒: ▒Ҳ▒▒▒▒▒▒޷▒▒▒▒▒▒▒▒▒ can't Any idea? Thanks. 回答1: Although sharajava have found a solution by himself, I have to say that this solution is not very preferable at least for me. The problem is if you change the Terminal Options of Text ("CharSet" of mintty actually) to "GBK", what will UTF-8 characters

Some of the outputs from cygwin just can not be read with bad encoding?

若如初见. 提交于 2020-01-01 19:03:01
问题 I'm using cygwin on Win7-64bit, and with "zh_CN.UTF-8" as default locale setting. Occasionally, some of the outputs from cygwin just can not be read with bad encoding like follows: [junit] ▒▒▒▒: ▒Ҳ▒▒▒▒▒▒޷▒▒▒▒▒▒▒▒▒ can't Any idea? Thanks. 回答1: Although sharajava have found a solution by himself, I have to say that this solution is not very preferable at least for me. The problem is if you change the Terminal Options of Text ("CharSet" of mintty actually) to "GBK", what will UTF-8 characters

Counting consecutive characters in a string

三世轮回 提交于 2020-01-01 09:42:01
问题 I need to write a code that slices the string (which is an input), append it to a list, count the number of each letter - and if it is identical to the letter before it, don't put it in the list, but rather increase the appearance number of that letter in the one before.. Well this is how it should look like : assassin [['a', 1], ['s', 2], ['a', 1], ['s', 2]], ['i', 1], ['n', 1] the word assassin is just an example of the need.. My code so far goes like this: userin = raw_input("Please enter

How to declare array of allocatable scalars in Fortran?

旧城冷巷雨未停 提交于 2020-01-01 09:13:10
问题 Allocatable arrays are possible in Fortran 90 and up. INTEGER, ALLOCATABLE, DIMENSION(:) :: test_int_array Allocatable scalars such as allocatable characters are possible in Fortran 2003. CHARACTER(LEN=:), ALLOCATABLE :: test_str I am wondering is it possible to declare an array, fixed or allocatable, of allocatable characters? (Possibly like something below, which does not compile unfortunately.) CHARACTER(LEN=:), ALLOCATABLE, DIMENSION(4) :: test_str_array 回答1: program test_alloc character

Illegal Characters appended to javascript file

对着背影说爱祢 提交于 2020-01-01 04:54:08
问题 I think my apache webserver has got problem. I can't reference jquery.js I get the following errors: With chrome: Uncaught SyntaxError: Unexpected token ILLEGAL With firefox: Error: illegal character Source File: http://xxxxxxxxx/test/javascript/jquery.js Line: 1 Source Code: �Hz�ÚH[9�R Below is my test html code <html> <head> <script type="text/javascript" src="javascript/jquery.js"></script> <script type="text/javascript"> function doclick(){ jQuery('#hello').attr('value', "mmmmef") } <

How to make Haskell or ghci able to show Chinese characters and run Chinese characters named scripts?

为君一笑 提交于 2020-01-01 04:24:08
问题 I want to make a Haskell script to read files in my /home folder. However there are many files named with Chinese characters, and Haskell and Ghci cannot manage it. It seems Haskell and Ghci aren't good at displaying UTF-8 characters. Here is what I encountered: Prelude> "让Haskell或者Ghci能正确显示汉字并且读取汉字命名的文档" "\35753Haskell\25110\32773Ghci\33021\27491\30830\26174\31034\27721\23383\24182\19988\35835\21462\27721\23383\21629\21517\30340\25991\26723" 回答1: Prelude> putStrLn "\35753Haskell\25110

fputs/puts dangerous (in C)?

心已入冬 提交于 2019-12-31 07:00:24
问题 I've been having trouble with fputs lately: when printing some strings in a text file with fputs, it happens I get other characters than A-Z, a-z, 0-9 in (chars that aren't part of the string). I made absolutely sure the strings all end with the null character. Unfortunately I can't give you more information, since I did not personally test the program, that was the feedback I received. But after I replaced fputs with fprintf it worked properly. So my question is: is fputs sort of dangerous?

Can't make (UTF-8) traditional Chinese character to work in PHP gettext extension (.po and .mo files created in poEdit)

为君一笑 提交于 2019-12-30 19:55:14
问题 I checked MSDN and the locale string is zh_Hant, but I also tried with zh_TW (Chinese, Taiwan). The traditional Chinese characters look OK in the poEditor, but when I open the file in the browser the characters are just weird symbols («¢Åo¥@¬É!). I think the translation is working, but there's something wrong with the encoding (I used UTF-8 for both Charset and Source Code Charset). The files generated with poEditor: messages.po: msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs

Are all the Unicode characters supported on Android

巧了我就是萌 提交于 2019-12-30 09:52:59
问题 My question is simple. Are all Unicode characters available in Android? I actually am using the soft keyboard and I want to add a few arabic letters which I can't find the codes for. 回答1: Android supports UTF-8 but you will not be able to use arabic, if it's not installed in your OS. There are ways to install new fonts, but some of them needs jailbreaking your phone. See link for installing font in Android: https://web.archive.org/web/20091023103506/http://www.android-devs.com/?p=33 回答2: It