Jul 25th, 2009 | No Comments

Standard numeric format strings are used to return string equivalents of numeric types in predefined patterns. When used with ToString, a standard numeric format string parameter takes the form.

object.ToString ( "Fn" );

where F is a single alphabetic character called the format specifier, and n can be one or more digits called the precision specifier.

The following table describes the standard numeric format strings. Note that the patterns produced by these format specifiers are influenced by the settings in the Regional Options control panel. Computers using different cultures or different currency settings will display different patterns.

Format specifierNameDescription
C or cCurrencyThe number is converted to a string that represents a currency amount. The conversion is controlled by the currency format information of the NumberFormatInfo object used to format the number. The precision specifier indicates the desired number of decimal places. If the precision specifier is omitted, the default currency precision given by the NumberFormatInfo is used.
D or dDecimalThis format is supported for integral types only. The number is converted to a string of decimal digits ( 0-9 ), prefixed by a minus sign if the number is negative. The precision specifier indicates the minimum number of digits desired in the resulting string. If required, the number is padded with zeros to its left to produce the number of digits given by the precision specifier.
E or eScientific ( exponential )The number is converted to a string of the form “-d.ddd�E+ddd” or “-d.ddd�e+ddd”, where each ‘d’ indicates a digit ( 0-9 ). The string starts with a minus sign if the number is negative. One digit always precedes the decimal point. The precision specifier indicates the desired number of digits after the decimal point. If the precision specifier is omitted, a default of six digits after the decimal point is used. The case of the format specifier indicates whether to prefix the exponent with an ‘E’ or an ‘e’. The exponent always consists of a plus or minus sign and a minimum of three digits. The exponent is padded with zeros to meet this minimum, if required.
F or fFixed-pointThe number is converted to a string of the form “-ddd.ddd�” where each ‘d’ indicates a digit ( 0-9 ). The string starts with a minus sign if the number is negative. The precision specifier indicates the desired number of decimal places. If the precision specifier is omitted, the default numeric precision given by the NumberFormatInfo is used.
G or gGeneralThe number is converted to the most compact decimal form, using fixed or scientific notation. The precision specifier determines the number of significant digits in the resulting string. If the precision specifier is omitted, the number of significant digits is determined by the type of number being converted:

  • Int16 or UInt16: 5 digits
  • Int32 or UInt32: 10 digits
  • Int64 or UInt64: 19 digits
  • Single: 7 digits
  • Double: 15 digits
  • Decimal: 29 digits

Trailing zeros after the decimal point are removed, and the resulting string contains a decimal point only if required.

The resulting string uses fixed-point format if the exponent of the number ( as produced by the ‘E’ format ) is less than the number of significant digits, and greater than or equal to –4. Otherwise, the resulting string uses scientific format, and the case of the format specifier controls whether the format is prefixed with an ‘E’ or an ‘e’.

N or nNumberThe number is converted to a string of the form “-d,ddd,ddd.ddd�”, where each ‘d’ indicates a digit ( 0-9 ). The string starts with a minus sign if the number is negative. Thousand separators are inserted between each group of three digits to the left of the decimal point. The precision specifier indicates the desired number of decimal places. If the precision specifier is omitted, the default numeric precision given by the NumberFormatInfo is used.
P or pPercentThe number is converted to a string that represents a percent as defined by the NumberFormatInfo.PercentNegativePattern property or the NumberFormatInfo.PercentPositivePattern property. If the number is negative, the string produced is defined by the PercentNegativePattern and starts with a minus sign. The converted number is multiplied by 100 in order to be presented as a percentage. The precision specifier indicates the desired number of decimal places. If the precision specifier is omitted, the default numeric precision given by NumberFormatInfo is used.
R or rRound-tripThe round-trip specifier guarantees that a numeric value converted to a string will be parsed back into the same numeric value. When a numeric value is formatted using this specifier, it is first tested using the general format, with 15 spaces of precision for a Double and 7 spaces of precision for a Single. If the value is successfully parsed back to the same numeric value, then it is formatted using the general format specifer. However, if the value is not successfully parsed back to the same numeric value, then the value is formatted using 17 digits of precision for a Double and 9 digits of precision for a Single. Although a precision specifier can be appended to the round-trip format specifier, it is ignored. Round trips are given precedence over precision when using this specifier. This format is supported by floating-point types only.
X or xHexadecimalThe number is converted to a string of hexadecimal digits. The case of the format specifier indicates whether to use uppercase or lowercase characters for the hexadecimal digits greater than 9. For example, use ‘X’ to produce ‘ABCDEF’, and ‘x’ to produce ‘abcdef’. The precision specifier indicates the minimum number of digits desired in the resulting string. If required, the number is padded with zeros to its left to produce the number of digits given by the precision specifier. This format is supported for integral types only.

Written by Ajay Matharu

July 25th, 2009 at 12:03 pm

Jul 24th, 2009 | No Comments

Dreams have wings. But to fly, we need courage and a little bit of madness. It is possible to do what seems impossible. But for that, you need to visualise success.

Look at what Sarath Baabu has achieved just by dreaming big. He grew up in a Chennai slum, had difficulty paying his tenth standard fees but did not give up. He cracked the IIM entrance, and was in Ahmedabad studying business strategies. But he never lost sight of where he ahd come from, and how his mother struggled while selling idlis, working as a cook and as an adult education teacher in the night to help him reach where he was.

she never complained as she did multiple jobs seven days a week to make ends meet, the meager earnings from cooking was just Rs. 30 a month at a government centre and Sarathbabu as a child knew what the struggle meant. The only way he could acknowledge his mother’s effort was to study. He did it with all his heart. It paid off as he was a topper all through school. Education was free but from 10th standard onwards, the fees were over Rs. 2000. So, he started working as a binder. As his work was good, he got more work. He soon employed 20 others to meet the demand. For the first time, he knew what it meant to be an entrepreneur. A dream was born.

Sarathbabu had never heard of institutions like BITS, Pilani. But a classmate suggested that since he got good marks, he had great chance of getting admission. He tried and got it. But the fees to be paid worked out to over Rs. 40,000. One of his sisters pawned her jewellery to pay for the first semester.

His mother found that he could get a scholarship. It not only helped him pay for other semisters but also to pay back his sister. But he still had to borrow for his food and other small needs and the debts were piling. He also found it difficult to adjust to his affluent classmates. But he kept working hard, and his popularity grew. As he got into leadership positions in his calss he learnt how to handle people. Classmates were appreciative and suggested that he must do his MBA due to the managerial skills he had. But he wanted to help his mother out and so he took up a job at Polaris. But he appeared for the entrance exams for IIM’s and cracked it.

He had once read that 30 percent of people go hungry in India and wondered what could be done. He admired entrepreneurs like Narayan Murthy who employed huge number of people as they in turn could support their families. He wanted to do the same as an entrepreneur. At IIM, Ahemedabad, he took up leadership roles to hone himeself. By the time he finished, there were lucrative offers, but Sarathbabu wanted to be on his own and said no to jobs that offered salaries of eight lak rupees a year. If his mother could have been an entrepreneur, he could also follow suit, he told himself.

Like his mother, he wanted to start a food business. He got capital of  Rs 1 lakh. He got a bank loan and set up an office in Ahmedabad. Soon he had 40 employees and numerous good clients. the monthly tournover touched Rs. 2.5 laks. After that, It kept rising. His focus was not profits, but how more could be employed to emerge as a wealth creator for small families.

Often, great thoughts come from simple minds. He continues to live a simple life as that is where he has learnt the greatest lessons of life.

Written by Ajay Matharu

July 24th, 2009 at 9:34 am

Posted in Motivation

Tagged with ,