formatting

How to change Phone number format in input as you type?

孤街浪徒 提交于 2019-12-29 14:17:22
问题 My CodePen: http://codepen.io/leongaban/pen/cyaAL I have an input field for a phone number which allows up to 20 characters (for international numbers). I'm also using the Masked input jQuery plugin by Josh Bush to format the phone number in the input to make it 'pretty'. My problem is that in the requirements when the phone is 10 digits or less, it should use the Masked input formatting. However when the phone number is longer then 10 digits, the formatting should be removed. Here is my

Crystal Reports DateTime Formatting

£可爱£侵袭症+ 提交于 2019-12-29 08:50:52
问题 I'd like to format a datetime in Crystal Reports to a include the day of week. From: 19/06/2009 To: Friday, June 19, 2009 回答1: In Crystal Reports XI Release 2 you can right click on the field and go to Format Field. On the "Date and Time" tab click the customize button. Under the Date Tab change the Date Type drop down to "Windows Default Long". 回答2: If in a formula, you can use the following. CSTR({?@end_dt}, "dddd, MMMM d, yyyy") 回答3: If the DateTime is in field (not a formula) : Right

asp:repeater - headers at section change

断了今生、忘了曾经 提交于 2019-12-29 08:46:15
问题 is there any way to bring up a subheader row at changes in a field in an databound asp:repeater control e.g. Instead of country | colour | number uk | red | 3 uk | green | 3 france | red 3 Do this: ==UK== colour | number red | 3 green 3 ==FRANCE== colour | number red | 3 Many thanks for any help. 回答1: There's no built-in support, but that doesn't mean it's impossible. You'll need to over-ride the OnItemDataBound event, and have something like this in markup: <asp:Repeater OnItemDataBound=

Copy format from one row to another using c#

十年热恋 提交于 2019-12-29 08:43:29
问题 This question is quite similar to the one asked here. But the answer given suggests copying the format along with the data. I have a excel sheet (.xlsx) that I generate using SSIS. Now I have set the formatting in first row, which I want to copy to all the rows that are already filled in the worksheet. How can I do that using C#? I am using Excel interop. 回答1: You can use PasteSpecial with xlPasteFormats . Excel.Range R1 = (Excel.Range)oSheet.Cells[11, 11]; R1.Copy(Type.Missing); Excel.Range

forcing 4 digits year in java's simpledateformat

孤人 提交于 2019-12-29 08:31:50
问题 I want to validate and parse dates using a simpleDateFormat with the format "yyyymmdd" This also allows 100624, which is parsed to the year 10 (54 years after Julius Ceasar died). The dates will also be something like 1970, so I don't want to settle with SimpleDateFornat("yymmdd"). I'm wondering is there a way to force a four digit year format using the SimpleDateFormat? I'm close to do a regexp test upfront but maybe there is a smart way to use the (Simple)DateFormat()? As requested the code

How to add line numbers to an output file?

拥有回忆 提交于 2019-12-29 08:23:58
问题 Write a program that asks the user for a file containing a program and a name for an output file. Your program should then write the program, with line numbers to the output file. For example, if the input file is: def main(): for i in range(10): print("I love python") print("Good bye!") Then the output file would be: 1 def main(): 2 for i in range(10): 3 print("I love python") 4 print("Good bye!") I know how to create a new output file but I have difficulty in adding line numbers to each

C++ printf: newline (\n) from commandline argument

旧时模样 提交于 2019-12-29 08:09:07
问题 How print format string passed as argument ? example.cpp: #include <iostream> int main(int ac, char* av[]) { printf(av[1],"anything"); return 0; } try: example.exe "print this\non newline" output is: print this\non newline instead I want: print this on newline 回答1: No, do not do that! That is a very severe vulnerability. You should never accept format strings as input. If you would like to print a newline whenever you see a "\n", a better approach would be: #include <iostream> #include

Format JSON string in scala

安稳与你 提交于 2019-12-29 07:49:12
问题 Is there a straight forward way to format a JSON string in scala? I have a JSON String like this: val json = {"foo": {"bar": {"baz": T}}} Can I use a function f such that: f(json) = { "foo": {"bar": {"baz": T} } } I know the formatting I have done in my answer is no perfect, but you get the point. And yes, can it be done without using Play Framework? 回答1: In case you are using Play Framework you could use Json.prettyPrint method to format JsValue : import play.api.libs.json.Json val str = """

How to print '\n' instead of a newline?

浪尽此生 提交于 2019-12-29 07:42:08
问题 I am writing a program that uses prints a hex dump of its input. However, I'm running into problems when newlines, tabs, etc are passed in and destroying my output formatting. How can I use printf (or cout I guess) to print '\n' instead of printing an actual newline? Do I just need to do some manual parsing for this? EDIT: I'm receiving my data dynamically, it's not just the \n that I'm corned about, but rather all symbols. For example, this is my printf statement: printf("%c", theChar); How

How can I add the French trademark symbol (MD)?

ⅰ亾dé卋堺 提交于 2019-12-29 07:31:37
问题 I have a report that needs to be output in either English or French (based on a field value). I have copied the text from the Word document to the SSRS package, and all French characters show as they should except MD (marque déposée). This should show similar to superscript "MD", but it shows as normal script "MD". Is there a library of French symbols that I can add, or is there a way to format it so that it "appears" right? I have tried: adding MD to a separate textbox and formatting it so