String的小写字母“true”和“假的”不工作 [英] Lower case for String "true" and "false" not working
问题描述
大家好我有一个包含字符串true和false的CSV格式文件,但Excel 2010中的CSV文件会自动转换为大写字母。我需要与小写字符串相同。如何解决问题???
先谢谢
Hi all i have an CSV format file that contains string "true" and "false" but that CSV file from Excel 2010 it automatically converts to Upper case.I need same as lowercase string.How to resolve the problem???
Thanks in Advance
推荐答案
如果你有文字想要通过Excel保持未转换那么你必须将其保存在双引号包围的CSV文件中,例如如果文件包含
If you have text that you want to remain untransformed by Excel then you must save it in the CSV file surrounded by double-quotes e.g. if a file contains
TRUE,True,true,"True","true"
那么最后两列是显式文本列。
如果您将列设置为文本格式,那么当您保存文件时,它仍将保存为
Then the last two columns are explicitly text columns.
If you set the columns to "Text" format then when you save the file it will still be saved as
TRUE,True,true,True,true
注意缺少双引号字符
不幸的是,如果你双击CSV或使用文件,打开,从Excel中,列将恢复为常规格式,上面的示例将显示为
Note the lack of double-quote characters
Unfortunately if you double-click on the CSV or use File, Open, from within Excel the columns will revert to "General" format and the example above will display as
TRUE TRUE TRUE TRUE TRUE
按顺序保留格式化导入数据到Excel中所需的格式。
使用文本导入向导,选择逗号作为分隔符,当你进入第3步,共3步,突出显示相应的列,然后单击文本RadioButton。现在,当您按完成时,Excel将显示
In order to retain the formatting you need to Import the data into Excel.
Using the Text Import Wizard, choose comma as the delimiter and when you get to "Step 3 of 3" highlight the appropriate column and click the "Text" RadioButton. Now when you press "Finish" Excel will display
TRUE TRUE TRUE True true
需要注意的一件非常重要的事情 - 在原始电子表格中 TRUE
的值为,或者, TRUE
...无论是真还是假。但是在CSV中,您强制列为文本值。您可以使用以下公式(在Excel中)来报告值(将其从A列拖到E列
One very important thing to note - in your original spreadsheet TRUE
has a value of, well, TRUE
...in the either True or False sense. But in your CSV you are forcing the column to be a text value. You can demonstrate this by using the following formula (in Excel) to report on the values (dragging it across from Column A to Column E
=IF(A1=TRUE, "yep", "nope")
您应该注意,对于列D和E,nope是结果。在您坚持true保持小写之前,请考虑这将对工作表的任何其他区域产生的影响...是RyanDev在他们的观点3中指出的。
You should note that for Columns D and E "nope" is the result. Before you insist on "true" staying as lowercase, consider the impact this will have on any other areas of the worksheet... this is what RyanDev was pointing out to in their point 3.
这篇关于String的小写字母“true”和“假的”不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!