mam adres MAC, który jest sformatowany jak 0018103AB839
i chcę, aby wyświetlić to lubią: 00:18:10:3A:B8:39
Format adresu MAC za pomocą string.Format wC#
próbuję to zrobić z string.Format
ale ja naprawdę nie mogę znaleźć dokładna składnia.
teraz próbuję coś takiego:
string macaddress = 0018103AB839;
string newformat = string.Format("{0:00:00:00:00:00:00}", macaddress);
Czy to w ogóle możliwe? czy powinienem użyć string.Insert
?
powinieneś rozważyć wyrażenie regularne takiego http://stackoverflow.com/questions/4260467/what-is-a-regular-expression -for-a-mac-adres – Marc
nie jest ragexem tylko do znalezienia czegoś w stylu, staram się przekonwertować styl :) – 2pietjuh2
Nie dokładny duplikat, ale prawie ten sam problem: http: // stackoverflow. com/questions/188510/how-to-format-a-string-as-a-telephone-number-in-c-sharp –