C#中Format(iCryptedByte, "000")
(VB.NET)的等效代码是什么?
答案 0 :(得分:10)
答案 1 :(得分:2)
另一个非常有用的C#字符串格式网站:http://blog.stevex.net/string-formatting-in-csharp/
您也可以使用零占位符代替{0:D3}
,例如{0:000}
将使用零填充最小长度为3。
答案 2 :(得分:1)
鉴于此VB代码:
{
"name": "angular-quickstart",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"scripts": {
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"build:e2e": "tsc -p e2e/",
"serve": "lite-server -c=bs-config.json",
"serve:e2e": "lite-server -c=bs-config.e2e.json",
"prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"pree2e": "npm run build:e2e",
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
"preprotractor": "webdriver-manager update",
"protractor": "protractor protractor.config.js",
"pretest": "npm run build",
"test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
"pretest:once": "npm run build",
"test:once": "karma start karma.conf.js --single-run",
"lint": "tslint ./src/**/*.ts -t verbose"
},
"repository": {},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@amcharts/amcharts3-angular": "^1.2.0",
"@angular/animations": "^4.1.3",
"@angular/cli": "^1.0.4",
"@angular/common": "^4.1.3",
"@angular/compiler": "^4.1.3",
"@angular/compiler-cli": "^4.1.3",
"@angular/core": "^4.1.3",
"@angular/forms": "^4.1.3",
"@angular/http": "^4.1.3",
"@angular/material": "^2.0.0-beta.5",
"@angular/platform-browser": "^4.1.3",
"@angular/platform-browser-dynamic": "^4.1.3",
"@angular/platform-server": "^4.1.3",
"@angular/router": "^4.1.3",
"angular-in-memory-web-api": "~0.3.0",
"angular-material": "^1.1.5",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"md-collection-pagination": "^1.0.3",
"mydaterangepicker": "^4.1.9",
"ng-sidebar": "^7.1.0",
"ng2-tree": "^2.0.0-rc.4",
"ngx-toggle-switch": "^1.3.9",
"rxjs": "5.0.1",
"systemjs": "0.19.40",
"typescript": "^2.3.2",
"ui-navbar": "^0.5.2",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.0.0",
"@types/hammerjs": "^2.0.34",
"@types/jasmine": "2.5.36",
"@types/node": "^6.0.46",
"canonical-path": "0.0.2",
"concurrently": "^3.2.0",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"lite-server": "^2.2.2",
"lodash": "^4.16.4",
"node-sass": "^4.5.3",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"sass-loader": "^6.0.5",
"tslint": "^3.15.1",
"typescript": "~2.2.0"
}
}
替换为此C#代码:
Strings.Format(iCryptedByte, format)
答案 3 :(得分:0)
答案 4 :(得分:0)
尝试:
iCryptedByte.ToString("D3");
答案 5 :(得分:0)
Microsoft.VisualBasic.Strings.Format(iCryptedByte, "000");
您需要添加对Microsoft.VisualBasic程序集的引用。