我有一个德国客户,他希望他的页面上有一些数字
4,3
代替
4.3
因为我无法为项目或控制器全局设置数字格式,因为我有javascript取决于英文格式,我正在寻找一个简单的替换方法在gsp中像
${number.replace(/./,",")}
Run Code Online (Sandbox Code Playgroud)
但那导致了
没有方法签名:java.lang.Double.replace()适用于参数类型:(java.lang.String,java.lang.String)
任何的想法 ?提前致谢
I often deal with time series data with timescales of years, months, days, minutes, and seconds. When plotting, it would be convenient to easily change the way the time series axes are displayed, along the lines of a strptime command.
library(lattice)
t_ini = "2013-01-01"
ts = as.POSIXct(t_ini)+seq(0,60*60*24,60*60)
y = runif(length(ts))
# default plot with time series axis in M D h:m
xyplot(y~ts)
# this attempt at using format to display only hours on the x-axis does not work:
xyplot(y~ts, scales=list(x=list(labels=format("%H")))) …Run Code Online (Sandbox Code Playgroud) 我必须发送JSON:
{"val": 5000.00}
Run Code Online (Sandbox Code Playgroud)
无论是{"val": "5000.00"}也不{"val": 5000}是正确的格式.
json_encode()将5000.00转换为5000
是否有可能与发送正确的JSON的格式(两个零)json_encode从
array("val" => (float) 5000.00)?
所以我有一个python程序,我正在使用该logging模块,当我设置日志字符串的格式时,它给出了这个错误:
ValueError: unsupported format character ':' (0x3a) at index 24
Logged from file snippets-convert.py, line 36
Run Code Online (Sandbox Code Playgroud)
这是一个真正的痛苦!
这是我正在使用的代码:
logging.basicConfig(
format='%(asctime)s:%(levelname):%(message)',
datefmt='%m/%d/%Y %I:%M:%S %p',
filename='./data/'+time.strftime("%d-%m-%Y")+ '.log',
level=logging.DEBUG)
Run Code Online (Sandbox Code Playgroud)
和完整的追溯:
Traceback (most recent call last):
File "/usr/lib/python3.3/logging/__init__.py", line 937, in emit
msg = self.format(record)
File "/usr/lib/python3.3/logging/__init__.py", line 808, in format
return fmt.format(record)
File "/usr/lib/python3.3/logging/__init__.py", line 549, in format
s = self.formatMessage(record)
File "/usr/lib/python3.3/logging/__init__.py", line 518, in formatMessage
return self._style.format(record)
File "/usr/lib/python3.3/logging/__init__.py", line 364, in format
return self._fmt % record.__dict__
ValueError: unsupported …Run Code Online (Sandbox Code Playgroud) 我想转换成字符串像1/15/2014 9:57:03 AM或1/15/2014 5:49:39 PM以9:57:03与17:49:39
我有一个旧的Fortran 77代码,我想在F90编译器中运行,我的目标是尽可能少地更改代码.它工作得很好,但我在代码中的格式语句有一些问题.我不明白这是什么问题.我使用Eclipse和gfortran.我使用自由形式.
编译好:
program HelloWorld
400 FORMAT(7HK GAMMA,2X,G13.5,7H P0,2X,G13.5,6H A1,2X,G13.5)
end program
Run Code Online (Sandbox Code Playgroud)
这不编译
program HelloWorld
400 FORMAT(7HK 'GAMMA',2X,G13.5,7H 'P0',2X,G13.5,6H 'A1',2X,G13.5)
1
end program
Run Code Online (Sandbox Code Playgroud)
错误是
P描述符需要格式字符串中的前导比例因子(1)
(错误是从德语翻译的,可能不是完全相同的英文单词)有什么问题?
这也编译好:
program HelloWorld
400 FORMAT(7HK GAMMA,2X,G13.5,7H P0, &
2X,G13.5,6H A1,2X,G13.5)
end program
Run Code Online (Sandbox Code Playgroud)
如果我在最后一个代码中添加更多代码:
program HelloWorld
400 FORMAT(7HK GAMMA,2X,G13.5,7H P0,2X,G13.5,6H A1,2X,G13.5, &
2X,7HK,ALPHA-1,2X,G13.5,7H BETA-4,2X,G13.5 )
end program
Run Code Online (Sandbox Code Playgroud)
它不再编译.错误是:
P格式字符串*中预期的编辑描述符(1)
而(1)位于右括号后的第三行.
*我不确定"格式字符串"的翻译,因为我的控制台是德语.
有什么问题?
我不知道如何将我的货币设置为0个小数。目前,它总是使我的货币落后0.00。
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
damn = locale.currency(self.damn, grouping=True).replace('$','') + " Dmn"
Run Code Online (Sandbox Code Playgroud)
self.damn始终是整数。
我有一个这样的日期:
3/6/2014 7:20
Run Code Online (Sandbox Code Playgroud)
我希望它被格式化为
03/06/2014 07:20
Run Code Online (Sandbox Code Playgroud)
这样做的最佳做法是什么?
我正在使用格式:
type ="$ ###,###,## 0.00"
用于货币并将格式类型分配给工作表单元格
例如.
wrkSheet.Cells[0].Style.Numberformat.Format = formatType;
但是这是在excel中作为文本类型插入的.我希望将其作为货币或数字插入,以便继续对插入的值(排序,总和等)进行分析.
目前,因为它是文本类型验证不正确.有没有办法强制可以插入格式化值的类型?
我正在使用NdefFormatable类来格式化我的NFC卡.代码如下:
NdefFormatable formatable=NdefFormatable.get(tag);
Run Code Online (Sandbox Code Playgroud)
但是我将formtable reference作为null.我检查了在get(tag)方法中运行的代码.它检查:
if (!tag.hasTech(TagTechnology.NDEF_FORMATABLE)) return null;
Run Code Online (Sandbox Code Playgroud)
我为我的标签运行了"tag.getTechList()".我有:
android.nfc.tech.NfcA
android.nfc.tech.Ndef
Run Code Online (Sandbox Code Playgroud)
我能够使用Trigger应用程序格式化此卡.
可以做些什么来格式化这个.