4bots

Home
 Edito
 Projets
 Kapharnaüm
 Forums

Contribs
 GraphiK
 ArtiKles
 Prog
C, C++
Site Web, DHTML
PHP, MYSQL
ASP
Visual Basic
Delphi
Java
CGI, Perl
Flash
Game Editing
XML, XHTML, XSL
Coldfusion
DNF
 Tutoriaux
 Rechercher

Goodiez
 ESRA
 Games
 Divers

Download
 Repository

Sheep Corp
 Les Membres
 Foire aux Questions
 Infos sur le site

S'identifier :.

Pseudo

Mot de passe


Membres Connectés
Zéro, nada, pas un sheep.
zik link zone
topic ou l'on peut laisser des liens musicaux afin de faire profiter toute la sheep community des differents sons ke l'on apprecie sur le moment


dariliaz

Voir l'ESRA
Ajouter une def
Fly with me ! de ahinu
Et on passe pour des fous a vouloir faire voler des moutons

Breaking News! de Merlin
Sheep-team is back... and it's gonna kick asses ! (ou pas...)

Yeah Net de Hawai
[This is the end]

Yeah! de Audiofeline
Sheep-Team.org, un site qui doit bien servir à quelque chose

Optimisation de douceur
Renard de feu trop lent? Allez donc là. Ce site vous propose des versions de Firefox et Thunderbird optimisées pour votre processeur.

Les brèves sheep-team dot org c'est la garantie de goodiz frais repêchés chaque jour dans les marécages yodassiens et vendus par cinq sans conservateurs.

Proposer | Archives
7 ans plus tard
affichage d'un frorum DNF avec chrome
Bonne Année
It's alive !!!!
bug report & evolutions
[Sheep Team] The topic
Plus fort que Ride, le nombre 21!
Concour : sheep sur google
Norme
Requete SQL

Prog . C, C++

Utilisation de la méthode Format en C#
Tutorial écrit par Merlin le 7 sept 2004

Retour
Utilisation de la méthode Format en C#
======================================

- Elle se trouve dans le namespace String (=> on l'appelle par String.Format() )
- Elle permet de formatter un string suivant un pattern dfini par l'utilisateur.

Différents pattern pour la méthode format
-----------------------------------------

Il existe des formats prédéfinis, tels que: (tirés de l'aide MSDN)
Format pour les dates :



General Date, or G
Displays a date and/or time. For example, 4/3/93 05:34 PM. Date display is determined by your system's LocaleID value.

Long Date, or D
Displays a date according to your locale's long date format.

Medium Date
Displays a date using the medium date format appropriate for the language version of the host application.

Short Date, or d
Displays a date using your locale's short date format.

Long Time, or T
Displays a time using your locale's long time format; includes hours, minutes, seconds.

Medium Time
Displays time in 12-hour format using hours and minutes and the AM/PM designator.

Short Time, or t
Displays a time using the 24-hour format, for example, 17:45.

f
Displays the long date and short time according to your locale's format.

F
Displays the long date and long time according to your locale's format.

g
Displays the short date and short time according to your locale's format.

M,m
Displays the month and the day of a date.

R,r
Formats the date and time as Greenwich Mean Time (GMT)

s
Formats the date and time as a sortable index.

u
Formats the date and time as a GMT sortable index.

U
Formats the date and time with the long date and long time as GMT.

Y, y
Formats the date as the year and month.



format pour les nombres :



General Number, G, or g
Displays number with no thousand separator.

Currency,C, or c
Displays number with thousand separator, if appropriate; display two digits to the right of the decimal separator. Output is based on system locale settings.

Fixed, F, or f
Displays at least one digit to the left and two digits to the right of the decimal separator.

Standard, N, orn
Displays number with thousand separator, at least one digit to the left and two digits to the right of the decimal separator.

Percent
Displays number multiplied by 100 with a percent sign (%) appended immediately to the right; always displays two digits to the right of the decimal separator.

P, or p
Displays number with thousandths separator multiplied by 100 with a percent sign (%) appended to the right and separated by a single space; always displays two digits to the right of the decimal separator.

Scientific
Uses standard scientific notation, providing two significant digits.

E, ore
Uses standard scientific notation, providing six significant digits.

D, ord
Displays number as a string that contains the value of the number in Decimal (base 10) format. This option is supported for integral types (Byte, Short, Integer, Long) only.

X, orx
Displays number as a string that contains the value of the number in Hexadecimal (base 16) format. This option is supported for integral types (Byte, Short, Integer, Long) only.

Yes/No
Displays No if number is 0; otherwise, displays Yes.

True/False
Displays False if number is 0; otherwise, displays True.

On/Off
Displays Off if number is 0; otherwise, displays On.



L'appel à cette méhnode se fait de la sorte :
my_formatted_string = string.Format(my_old_string, pattern)


Voilà, si vous avez des questions, n'hésitez pas
Infos:

Par: Merlin
Rubrique: C, C++
Appréciation:

Favoris: 0
Commentaires: 4
Popularité:

Vues: 17
Tutorial:

Taille: 4ko
Signaler un problème avec la charte
(copyright, contenu, ...)
Commentaires
Boab
Le glaude



Envoyé le:
07/09/04 20:18
Signaler un problème avec la charte
(copyright, contenu, ...)
Quand tu fais un post tu fais un post de barbare toi ^^
douceur
Blagus ineptus



Envoyé le:
25/10/04 05:45
Signaler un problème avec la charte
(copyright, contenu, ...)
Clair lol
Mais ça l'explique bien, c'est structuré. Mais c'est cru lol.
ridehard
Vive lui!!!



Envoyé le:
25/10/04 11:06
Signaler un problème avec la charte
(copyright, contenu, ...)
Suivant ce que tu vveux faire tu peux aussi utiliser sprintf
En Francais ca aurrait ete un peu mieux que ce copie colle..

Merlin
Enchanté...



Envoyé le:
25/10/04 22:32
Signaler un problème avec la charte
(copyright, contenu, ...)
ouaips... mais j'avais la flemme de tout traduire ^-^
Up!
© 2012 Sheep Team. Tous droits réservés.
Toute reproduction même partielle est interdite sans l'accord exprès, préalable et écrit de tous les auteurs concernés. Charte.