FAQ Database Discussion Community


How do I, or can I use a static resource for the StringFormat on a TextBlock?

c#,wpf,xaml,string-formatting
I have a text block that is displaying the date/time. The look of the clock may be different on some controls in the application, as far as color and maybe font, but I want the date and time to have the same format. I know I can set the StringFormat...

NPOI: Create a cell containing two differently sized strings

c#,excel,apache-poi,string-formatting,npoi
so as the title intends, I want to creaete a cell in a NPOI 2.1.3-Workbook containing 2 strings: A "normal"-sized string and a "small"-sized string. => I want to change the font-size for a part of the cell. My code so far: var planCell = planRow.CreateCell(lineCnt + 1); var planCellStyle...

JavaScript change format of a string, moving negative sign from the end to the front

javascript,string,string-formatting
I'm trying to format an output string from SAP, where they have negative sign placed at the end of the string. e.g 999.99- How can I use JavaScript or Groovy to adjusted this so that the negative numbers are formatted correctly? They should be -999.99 not 999.99-...

How to use a dot in Python format strings?

python,string-formatting
I want to format a string and be able to use the dot operator, so that I can construct template strings containing e.g. {user.name}, {product.price}. I tried this: 'Hello {user.name}'.format( {'user': { 'name': 'Markus' } } ) KeyError: 'user' 'Hello {user.name}'.format( **{'user': { 'name': 'Markus' } } ) AttributeError: 'dict'...

Format floating point number with leading zeros [duplicate]

java,string-formatting
This question already has an answer here: printf how to do floating points with leading zeros 3 answers Why does System.out.format("%03.3f", 1.23456789); print 1.235 instead of 001.235? How has my format string to look like to get 001.235 as output of the following code line? System.out.format(format, 1.23456789); ...

Formatting a time value

python,string-formatting
In the following program I am returning a boolean value and a value representing the execution time in a tuple: import time # O(n) time def isAnagram1(s1, s2): start = time.time() letterlist1 = [0] * 26 letterlist2 = [0] * 26 for i in xrange(0, len(s1)): pos = ord(s1[i]) -...

Any way to skip a formatter token when using String.format()?

java,string-formatting,string.format
I have a String myString = "%d New Voicemail"; I'd like to do this for 2: String myString = "%d New Voicemail"; System.out.println(String.format(myString, 2)); Output: 2 New Voicemail I'd like to do this for 5: String myString = "%d New Voicemail"; System.out.println(String.format(myString, 5)); Output: 5 New Voicemail I'd like to...

String.format java.util.IllegalFormatFlagsException: Flags = '#'

java,regex,string,string-formatting
I have a String with sql query: String string = "SELECT 1 FROM store WHERE merch_name like '%#1%'"; But later in code,I do String.format on that srting, for example: String s1 = String.format( string , ruleBody.getDateTimeStartValue() } and that's give me exception: java.util.IllegalFormatFlagsException: Flags = '#' I think that I...

Formating String for a serial number type

vb.net,format,string-formatting
I wish to format a string for display as a serial number e.g. abc12345d67890 to 00ab-c123-45d6-7890 if it was numbers i could DataGridView.Columns(2).DefaultCellStyle.Format = "0000-0000-0000-0000" MaskedTextBox1.Mask = ("0000-0000-0000-0000") but if it is a String this doesn't work. Can anyone help me in a direction? The information is displayed in 16...

Formatting a string in D

string-formatting,d
I read on D's documentation that it's possible to format strings with arguments as print statements, such as the following: float x = 100 / 3.0; writefln("Number: %.*g", 2, x); Number: 33.33 However, I'm wondering how I would do this if I just wanted the string equivalent, without printing it....

When trying to include “ in a String, using \” works but the \ is included too

xcode,string,swift,string-formatting
I'm trying to send a string to an Http request using the following code var outStr = "{product_code: \"660825\", quantity: \(qty)}" As I've included the \ character it compiles ok but when I run it the value for outStr is {product_code: \"660825\", quantity: 2} What am I doing wrong and...

String formatting in C

c,string,formatting,string-formatting
I am new to C and I am currently working on string formatting. In particular how you would format decimals to have 2 leading places. Thus you would have 1, 20, 300 become 001, 020, 300. I understand there is %d but I haven't figured out a solution!

Caused by: java.lang.IllegalArgumentException: Bad class: class java.lang.String

android,string-formatting
I'm trying to format dates which I retrieve from my database table, I wanted to format from "2015 02 11 12 00" to "Feb 2" but it gives an error when I format it. Is there any other ways formatting those dates? Following the codes: protected String doInBackground(String... args) {...

Extract substrings in python

python,regex,string-formatting
I want to parse a string to extract all the substrings in curly braces: 'The value of x is {x}, and the list is {y} of len {}' should produce: (x, y) Then I want to format the string to print the initial string with the values: str.format('The value of...

Why does Python string formatting silently ignore mismatched argument counts with class instances?

python,string-formatting
Normally, Python old-style string formatting complains if the number of placeholders in the string doesn't match the number of arguments passed: >>> 'no.placeholders.here' % 'test' Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: not all arguments converted during string formatting However, when the argument passed is...

What does the numbers in Java printf() mean?

java,string-formatting
When I see this in java, I know that the .2 is the decimal place, f is for float, n is for newline, etc. But what is the 6? System.out.printf("%6.2f2%n", someDouble); ...

Log4j Implicit String Formatting

java,logging,log4j,string-formatting
I am using log4j v1.2.14 for logging in my project and I am also using Java 7 String.format() to put variables in my output. Currently I am writing LOGGER.info(String.format("Your var is [%s] and you are [%s]", myVar, myVar1)); Is this really the best way to output strings? I feel that...

how to pad zero on left with String.Format

vb.net,string-formatting
i tried to use String.Format string with leading zero Dim formatstring As String = ("{0,0}{1}{2,0:YYYY-MM-DD}{3}{4,0:00000}{5}{6,0:00000}{7}{8}{9}{10}{11}{12}") with {4,0:00000} it would be fill zero on left example 014 to 00014 with {6,0:00000} it would be fill zero on left too example 547 to 00547 but it's not happen just still shown 014...

fprinf_s converts double to 0.0000

visual-c++,io,string-formatting
Lets keep it short. I've got the following snippet of code: double score = 9.987654 fopen_s(&output, "9.output.txt", "w"); fprintf_s(output, "%.4f", &score); fclose(output); It writes 0.0000 in 9.output.txt, where it should be printing 9.9876. Any idea of where is the problem?...

How can I append a formatted string to an existing String?

string-formatting,rust
Using format!, I can create a String from a format string. What if I already have a String that I'd like to append to? I would like to avoid allocating the second string, just to copy it and throw away the allocation. let s = "hello ".to_string(); append!(s, "{}", 5);...

Flex: Replacing characters in a string based on a mask

flex,string-formatting,masking
I am attempting to apply a mask to another string to replace all wildcards in one string with the matching characters in the matching index while keeping the non-wildcard characters. Eg: starting string: "1234-234-3456-45-9876" mask string: "____-___-0001-__-____" when applied together: "1234-234-0001-45-9876" Is this some usage of Regex I haven't seen...

Parse an f-style interpolated string to recover arguments

scala,parsing,string-formatting,string-interpolation
What's the best way to create the complement for an f-style string interpolation, i.e. a way to parse the arguments/numbers in a formatted string? E.g. val format = "frame%04d.png" val i = 123 val out = f"frame$i%04d.png" assert(out == "frame0123.png") def parse(s: String, pat: String): Int = ??? val j...

What does %[^<] (and friends) mean in the formatted string family?

c,string-formatting,scanf
A comment (which should probably be submitted as an answer) has the code sscanf(string, "<title>%[^<]</title>", extracted_string); Running the code seems to copy the text between the <title> tags to extracted_string, but I cannot find any references to a caret in the printf family, either in the man pages or elsewhere...

How to use string format on a list item

c#,list,string-formatting,drawstring
I'm using drawstring to get a item from a list to be displayed, but now i would like it to be displayed as a 4 digit number instead of a single digit. So instead of it displaying 0 i would like it to display 0.000 . If anyone could help...

Number formatting using php

php,string-formatting
I am using php. I want to display a number in a '$XX.XXX.XX' format. I tried the following code, but its not giving full output. <?php echo "$".number_format(round($customer['hourly_payment']),2); ?> Output $17,317.00 Please suggest a solution!...

Detect if string matches format specifier string

javascript,regex,string,string-formatting
I'm trying to do the process of formatting a string in reverse, that is to match an existing string to a printf like string format specifier string. I have an array of several strings, like so: var strings = [ "I have the number 5 and the word dog", "15...

Javascript: something like string.format with property names

javascript,regex,string-formatting
I wanted to make a method that i could pass a recordset (could just as easily be an general object) with format string to replace values by name. I found this other answer on SO that almost did it: http://stackoverflow.com/a/2534828/359135 function format(str, obj) { return str.replace(/\{\s*([^}\s]+)\s*\}/g, function(m, p1, offset, string)...

Python str.format() — passing in list, outputting list

python,string,string-formatting
I haven't used str.format() much before and am wondering how to pass in list values and retrieve a list output with these values passed in. i.e. listex = range(0, 101, 25) baseurl = "https://thisisan{0}example.com".format(*listex) I'd like a list output like ["https://thisisan0example.com", "https://thisisan25example.com", "https://thisisan50example.com", etc etc] but with my current code...

arbitrary number of *args or ** kwargs in str.format() in Python

python,python-3.x,string-formatting,args,kwargs
I'm making a socket client and need to define a function which sends the following kind of message to server: sometext,[name_1],[name_2],...,[name_n]. Actually the message is more complex, but for the sake of an example I simplified it. Where: ... - represents the rest of the names (comma delimited) between name_2...

Why is sscanf not reading the first argument in the format string?

c,string,string-formatting,sscanf
In the following program, everything but the first value (the month) in the format string is being read into the SYSTEMTIME structure. Can anyone help me figure this one out? #include <Windows.h> #include <stdio.h> int main() { SYSTEMTIME st; char buf[50]; strcpy(buf, "6/23/2015 12:00:00"); sscanf(buf, "%d/%d/%d %d:%d:%d", &st.wMonth, &st.wDay, &st.wYear,...

VLOOKUP is returning blank as 1/0/1990, rather than nothing visible

excel,date,formatting,string-formatting,vlookup
All cells are formatted for dates, when a cell is blank I would like it to return an apparently blank cell rather than 1/0/1900. Here is what I have so far however It is still returning the date instead of a blank: = IF(ISNA(VLOOKUP($B$4,TrainingDatabase!$A$3:$S$14,3,0))= 0,"", (VLOOKUP($B$4,TrainingDatabase!$A$3:$S$14,3,0))) ...

Converting Date from String to oracle.jbo.domain.Date in java [closed]

java,string,string-formatting
I have a date in string format like this 2/14/2014. I want to convert this date to oracle.jbo.Date Object in java. How can i do that? -Thanks...

string format custom parameter

c#,formatting,string-formatting,string.format
Is there a (simple/predefined) way to use the same string.format mechanism but use names instead of numbers? I want to use the same formatting system but make it more end-user friendly. Right now my users are putting in {0} {1:Minutes} after selecting what parameters they want to use from a...

Python: '{:,}'.format() why is this working?

python,string,string-formatting
There is a kata in codewars where the task is to write a function that takes an integer in input and outputs a string with currency format. For example 123456 -> "123,456". I had a solution, but it was much uglier than this one with string formatting: def to_currency(price): return...

Algorithm output to length starts new line

java,arrays,integer,string-formatting,system.out
I am trying to format the output from what I have written to display a list of primes (Eratosthenes) to a certain number results per line. Do they need to placed into an Array to accomplish this? I have not come across a way to implement their division besides .split("");,...

why is my string not in fixed size?

java,string,formatting,string-formatting
I try to print strings with padding (table like): StringBuilder sb = new StringBuilder(); sb.append(String.format("%1$15s", "bulk name")); sb.append(String.format(" | ")); sb.append(String.format("%1$15s", "baseline")); sb.append(String.format(" | ")); sb.append(String.format("%1$15s", "current")); sb.append(String.format(" | ")); sb.append("\n"); for (int i = 0; i < baseLine.tillOneSecondBulks.size(); i++) { sb.append(String.format("%1$15s", baseLine.tillOneSecondBulks.get(i).bulkName)); sb.append(String.format(" | "));...

Formatting date/time in php 4

php,string-formatting,datetime-format,php4
I'm working (or learning) on server with old php4 installed and most of the conventional methods from php5 for date/time formatting doesn't work in php4. I have time string in this format: 2003-07-23 10:15:00 Now whats the easiest way to get date separately in 23.7.2003 format and then time in...

How to format a floating number to fixed width with forced sign in Python

python,string,string-formatting
I'm trying to format a number to fixed width with a sign in Python - I can do one or the other but not both:'{:>5+.0f}'.format(43.5) doesn't work (ValueError: Invalid conversion specification) My current workaround is to do: '{:>5}'.format('{:+.0f}'.format(43.5)) But it doesn't seem very pretty - is there a way to...

How to reference the empty string key in the Format String Syntax?

python,string-formatting
The empty string ('') is a pertectly valid key for a dictionary, but I can not reference it using the Format String Syntax data = { 'a' : 'hello' , '' : 'bye' } print '{a:<14s}'.format(**data) print '{:<14s}'.format(**data) Which outputs: hello Traceback (most recent call last): File "xxx.py", line 3,...

Python, print with format a tuple, not working

python,python-2.7,string-formatting
Here is the code: #! /usr/bin/python def goodDifference(total, partial, your_points, his_points): while (total - partial >= your_points - his_points): partial = partial+1 your_points = your_points+1 return (partial, your_points, his_points) def main(): total = int(raw_input('Enter the total\n')) partial = int(raw_input('Enter the partial\n')) your_points = int(raw_input('Enter your points\n')) his_points = int(raw_input('Enter his...

separate a string 2 by 2 using Python3 macadress format

python-3.x,string-formatting
i want to use a function like "{}".format (variable) so i can transform a string like: " A1B345FS " And i want to have something like: " A1:B3:45:FS " i am not able to use a while or a for. Can i use .join (variable) ????...

How to turn a list/tuple into a space separated string in python using a single line?

python,string,collections,formatting,string-formatting
I tried doing: str = "" "".join(map(str, items)) but it says str object is not callable. Is this doable using a single line?...

Can this be done with formatting strings alone?

c#,.net,vb.net,formatting,string-formatting
I think I've found something that can't be done with formatting strings alone: I'm needing a string that would allow me to format a double to show no decimals and so that: Numbers are thousand separated 0 shows a dash Negative numbers are shown between parentheses 0.5 is rounded to...

Format string with date by javascript to another format

javascript,date,format,string-formatting,date-formatting
I have string in this format: var date = "2012-02-12"; I would like return the date in this format: 12.2.2012 What is the easiest way for this? I was trying var date = new Date( "2012-02-12" ).format("dd.m.yy"); but its returning error undefined is not a function....

Int to hex conversion

ruby,hex,string-formatting
Concerning the following line(from here): "%.8x" % 7929856 #=> "00790000" I don't understand what is done with 7929856 to get the value "00790000". I know that 0x790000 is 7929856 in hexadecimal, but I don't know where the two leading zeros came from. Is this simply a method of converting the...

python dict in formated string [duplicate]

python,dictionary,string-formatting
This question already has an answer here: How can I print a literal “{}” characters in python string and also use .format on it? 4 answers I want to write a python dictionary in a string. The values of the items should be give by the formated string. I...

Need to format automatically numbered rows in WPF ListBox

c#,wpf,listbox,string-formatting
I have a ListBox set up with automatic numbering as shown below. I want to format the number out front of each ListBoxItem so the numbers in all the rows are right aligned with each other. I figured I could use the item count to determine how many characters are...

How to pass tuple1 if … else tuple2 to str.format?

python,tuples,string-formatting
Put simply, why do I get the following error? >>> yes = True >>> 'no [{0}] yes [{1}]'.format((" ", "x") if yes else ("x", " ")) Traceback (most recent call last): File "<stdin>", line 1, in <module> IndexError: tuple index out of range I use python 2.6....

Format string with trailing zeros removed for x decimal places in Swift [duplicate]

swift,string-formatting
This question already has an answer here: Formatting decimal places with unknown number 3 answers This in Swift (1.2) let doubleValue1 = Double(10.116983123) println(String(format: "%.2f", doubleValue1)) let doubleValue2 = Double(10.0) println(String(format: "%.2f", doubleValue2)) Prints 10.12 10.00 I'm looking for a way using a formatter or a direct string format...

How to format a phone number in python

python,string-formatting,phone-number
So, I've got a really poor implementation of a phone number formatter. It should take the instance value for a phone number format it and return it in format of xxx.xxx.xxxx (for now it should only be a US phone number) The code can be found on this gist: https://gist.github.com/trtmn/a5a51c3da55ae0b32ac8...

Conversion with string formatter

python,string,python-2.7,string-formatting
I am using Python 2.7.6. I came across this accidentally today. I meant to convert an integer to string through formatters. Like this: a = 50 b = "%d" % (a) However, I did this instead a = 50 b = "%s" % (a) Which also ran fine. I couldn't...

Parsing into a string from type DateTime

c#,string-formatting
I am trying to convert a DateTime and an int property into a string in a foreach loop. I need to put the information that is stored in the objects properties into the variables and then use that info to write to a text file using StreamWriter. I'm not quite...

Format operator removes line breaks

powershell,string-formatting
I have a text file like this: File: sample1.txt foo: {0} bar: {1} Hello {2} I run the following commands: $txt = gc Sample1.txt $txt -f "bar","foo","world" I got the output: foo: bar bar: foo Hello world Where did all the line breaks go?...

IOS: Get current date/time with specific (non-localized) format

ios,objective-c,iphone,string-formatting,nsdateformatter
I want to get the current date/time in a very specific format like this: 2013-11-24_18_12_88 However, using the following code: NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd_hh_mm_ss"]; NSString *dateString = [dateFormatter stringFromDate:[NSDate date]]; I get this date string instead: 2013-11-24_18:12:88 How can I force the dateFormatter to not delete...

How remove some special words from a string content?

c#,string-formatting
I have some strings containing code for emoji icons, like :grinning:, :kissing_heart:, or :bouquet:. I'd like to process them to remove the emoji codes. For example, given: Hello:grinning: , how are you?:kissing_heart: Are you fine?:bouquet: I want to get this: Hello , how are you? Are you fine? I know...

DefaultListModel in Java modifies a String passed as an argument to addElement method

java,string-formatting,jlist,defaultlistmodel
I am facing an interesting issue trying to output POJO loaded from a database into JList using DefaultListModel. Briefly, this is my code: // load POJO objects from the DB PersonData[] allUsers = loadAllUserData(); DefaultListModel listModel = new DefaultListModel(); // fill in (with) the data for (int i = 0;...

Including Parenthisis inside a VBA db.Execute String

sql,vba,string-formatting
How do I format this line of code correctly to allow me to have the parenthesis inside the statement string? db.Execute("SQL DB", "INSERT INTO ABPCahirMIS.dbo.TESTDB (TEST) VALUES(1) ") ...

Avoid double quote confusion when generating CSV files?

ruby,csv,formatting,string-formatting,export-to-csv
I am pushing some strings to a CSV file: csv_string = CSV.generate({col_sep: ";", row_sep: "\n"}) do |csv| csv << ["101-41", "Sparri, \"Violet\" (rod) (1 bunt á 10 stk.)"] end When the CSV file is finally generated a regular Excel installation will display the content apparently corrent, but a closer look...

Why does String.Format fail to escape characters when the string is in a resource?

c#,string,.net-4.5,string-formatting
var result1 = String.Format("Hello\n\t{0}\n\n", "Bill"); // MyResource.FormatMe contains the same text: Hello\n\t{0}\n\n var result2 = String.Format(MyResource.FormatMe, "Bill"); result1 is as expected: "Hello Bill " result2 is not: Hello\n\tBill\n\n Why is String.Format not escaping escape characters when the format string comes from a resource?...

How to add space to formatting

string-formatting
Im new to coding, and found a script that writes the song and artist into a txt file called PlayLog.txt. When i use the script, it works as intended, however I do not know how to add space to the end of the output. so instead of "[song] by [artist]"...

Can I Use Multiple Properties in a StructuredFormatDisplayAttribute?

f#,string-formatting,f#-interactive
I'm playing around with StructuredFormatDisplay and I assumed I could use multiple properties for the Value, but it seems that is not the case. This question (and accepted answer) talk about customizing in general, but the examples given only use a single property. MSDN is not helpful when it comes...

Formating a string in Java when I'm not printing it

java,string-formatting
How can I format a string in Java when I'm not printing it? Eg. in Python I can do : s = "%f" % f All the Java examples I'm seeing online are using printf or some streams. How can I just create a formatted string internally?...

How to format numeric string?

c#,string,string-formatting
My text with not format is: 100000.00 I format it to: ("0:0,0 POINT") and I want it to: 100,000 POINT But I have no luck. So, how can it format it to 100,000 POINT? txtpoint.Text = string.Format("{0:0,0} POINT",(table_ca.Compute("SUM(POINT)", "")).ToString()); ...

Base64 string format in python

python,base64,string-formatting
I'm having an issue figuring out how to properly input base64 data into a string format in python 2.7. Here's the relevant code snippet: fileExec = open(fileLocation, 'w+') fileExec.write(base64.b64decode('%s')) %(encodedFile) # encodedFile is base64 data of a file grabbed earlier in the script. fileExec.close() os.startfile(fileLocation) As silly as it may...

Python format strings: 'Truncated incorrect DOUBLE value'

python,string-formatting,mysql-python
I format a string sql with sid (NOTE: the type of sid is str) sid = "34" #type(sid) is string, like 34, 34s sql = '''SELECT * FROM table_name WHERE sid={sid}'''.format(sid=sid) The result of print sql is: SELECT * FROM table_name WHERE sid=34 which is out of my expection (34...

C Language - how to ensure a constant format is kept while reading multiple input files?

c,whitespace,string-formatting
I'm trying to indent my string output for the below code but for some reason my variables keep being pulled from the files with ranging lengths of noise or space (I'm not to sure). This is my code: #include <stdio.h> #include <string.h> int main (void) { FILE *data_File; FILE *lake_File;...

Python: using .format method to populate string with list items

python,string,string-formatting
This seems like a question that should already have an answer, but I didn't find one. If anyone knows of another question that has already answered this, please post a comment with the link. My question is, is there a way to input the items from a list into a...

Formatting whitespace with tabs

python,python-3.x,string-formatting
Odd question here. I'm working with some pre-defined output that tab-separates, but with varying tab sizes. So, for example, data look like this: a: b,c qes: d,e Except with the \t character instead of spaces between the colon and the characters. I am trying to reproduce this type of output...

Can I operate on formatted strings?

python,string,string-formatting
A snippet of Python code: def someMethod(): return datetime.date.today().strftime("%B" + " " + "%d".lstrip('0') + ", " + "%Y") How come this returns: June 03, 2015 And not what I expected, which was: June 3, 2015 Thanks for your help....

When parsing datetime into month day with English culture, it is still parsed in Turkish language

c#,string,datetime,string-formatting,culture
Here is the code. I still get incorrect results string srRegisterDate = "25.07.2009 00:00:00" CultureInfo culture = new CultureInfo("en-US"); srRegisterDate = String.Format("{0:dddd, MMMM d, yyyy}", Convert.ToDateTime(srRegisterDate), culture); The result is Cumartesi, Temmuz 25, 2009 Instead it should be Saturday, July 25, 2009 How can i fix this error? C#.net v4.5.2...

How can I split an expression onto multiple lines in Python

python,string,whitespace,string-formatting
How can I split an assignment like this onto two lines? myLongVariableName = 'some somewhat long format string like this %s' % myOtherVariable I tried a few variations: myLongVariableName = 'some somewhat long format string like this %s' % myOtherVariable myLongVariableName = 'some somewhat long format string like this %s'...

String format Error “input string was not in a correct format.” [duplicate]

c#,string-formatting,string.format
This question already has an answer here: How to escape braces (curly brackets) in a format string in .NET 4 answers I am getting this error with the following line of code, int numberStored = 9; record.VALUE = string.Format("{\"FIELDS\":[{\"ELEMENT_ID\":\"275887826\",\"VALUE\":\"{0}\"}]}", numberStored.ToString(), 0); This works fine if i substitute out {0}...

Delphi 7: Formatting changes after using delete procedure

delphi,formatting,string-formatting,richedit
I was working on my text editor, which I have completed, but I still have this one problem I'm trying to solve. My problem is, that I want to delete specific symbols on the end of lines, which were created by pressing the speedbutton (button is down). So when I...

show string in a desire format

c#,string-formatting
I want to show my string in a special format. For example I have a string like this s = "00012345"; and want to show it in this format 000(123-45) I use this code for it: label1.text = string.format("{0,###(###-##)}",s); But just see this for result: 00012345. What string formatting should...

Convert an array row of REAL to a comma delimited string

format,fortran,string-formatting
I have a very old Fortran program which converts data from one text format to another. In one place it handles an array of data allocated as follows: real*4, allocatable :: s(:,:) ! is the declaration ! ... allocate (s(16,k)) ! is the allocation ! then, in a loop later...