Skip to content

Commit d58a517

Browse files
committed
main
1 parent c0e7fdd commit d58a517

File tree

4 files changed

+60
-11
lines changed

4 files changed

+60
-11
lines changed

docs/document/Modern CSharp/docs/Understanding String Formatting.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ You can specify the direction to be left or right.
2020

2121
The second syntax in composite formatting is a optional integer for the interpolation:
2222

23-
- specify direction of padding by `-`(pad spaces on left) and pad on right by default
23+
- specify direction of padding by `-`(leave interpolated on left) and pad on right by default
2424
- length of padding
2525

2626
```cs
@@ -51,5 +51,40 @@ string.Format("{0,-20}", 123);
5151
- supported for `Double`, `Single`, `Half` and `BigInteger` only.
5252
- ensures the converted string represents the exact precision of the number.
5353

54+
#### Arbitrary Format Composition
55+
56+
Composite formatting supports a dedicated syntax to represent any numeric format by following convention
57+
58+
- `0` to fill the unreached length
59+
- `#` to represent a single digit, does not fill up any or throw error when the `#` does not match the digits
60+
```cs
61+
double foo = 123.456;
62+
// shorter before decimal point and longer after
63+
// but still the same
64+
foo.ToString("##.#####################"); // 123.456
65+
// rounded
66+
foo.ToString("###.##"); // 123.46
67+
// if the format does not match the numeric(no decimal point here), will not preceed after
68+
foo.ToString("##,##"); // 123
69+
```
70+
- `.` to represent decimal point
71+
- `,` as group separator, real representation depends on `NumberFormatInfo.NumberGroupSeparator`, separated by `NumberFormatInfo.NumberGroupSizes`
72+
- `%` multiply the numeric with 100 and convert it to localized string
73+
- `‰` multiply the numeric with 1000 and convert it to localized string
74+
- exponential format fits `[eE][+-]?0+`, see: [documentation](https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings#the-e-and-e-custom-specifiers)
75+
- `;` to represent conditional solution for negative, zero and positive numeric within on format
76+
```cs
77+
// first section for positive value
78+
// second section for negative value
79+
// third section for zero
80+
string fmt = "+#.#;-#.#;I am zero";
81+
123.ToString(fmt); // +123
82+
(-123).ToString(fmt); // -123
83+
0.ToString(fmt); // I am zero
84+
```
85+
- `\` to escape any special character above
5486

5587
## `ToString` & `IFormattable`
88+
89+
90+
## Formatting Strategy

docs/document/PowerShell/docs/Registry/1.Overview.md

Whitespace-only changes.

docs/services/GithubService.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,21 @@ class GithubRepositoryEndPointMethods {
9999
const split = repo.split('/');
100100
const owner = split[0];
101101
const _repo = split[1];
102-
return (
103-
await octokit.rest.repos.getContent({
104-
owner: owner,
105-
repo: _repo,
106-
path: path,
107-
})
108-
).data as RepoFileSystemInfo;
102+
try {
103+
return (
104+
await octokit.rest.repos.getContent({
105+
owner: owner,
106+
repo: _repo,
107+
path: path,
108+
})
109+
).data as RepoFileSystemInfo;
110+
} catch (error) {
111+
console.error(`failed to fetch remote file from github repo: ${repo}/${path}`);
112+
console.log(
113+
`The path might have been changed, check out: "https://github.com/${repo}/${path}"`,
114+
);
115+
}
109116
}
110-
throw new Error();
111117
}
112118
}
113119
export class GithubService {

docs/services/ThemeService.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@ export type RemoteThemeInfo = {
2121
};
2222

2323
const themeInfos = {
24-
'Eva Light': { repo: 'fisheva/Eva-Theme', path: 'themes/Eva-Light.json', branch: 'master' },
25-
'Eva Dark': { repo: 'fisheva/Eva-Theme', path: 'themes/Eva-Dark.json', branch: 'master' },
24+
'Eva Light': {
25+
repo: 'fisheva/Eva-Theme',
26+
path: 'VSCode/themes/Eva-Light.json',
27+
branch: 'master',
28+
},
29+
'Eva Dark': {
30+
repo: 'fisheva/Eva-Theme',
31+
path: 'VSCode/themes/Eva-Dark.json',
32+
branch: 'master',
33+
},
2634
} satisfies Record<string, RemoteThemeInfo>;
2735

2836
export type ThemeName = keyof typeof themeInfos;

0 commit comments

Comments
 (0)