我正在通过12345678.02并且我希望获得小数后的值,即“02”然后我确实有另一个文本文件想要替换该值。
<add key="BuildVersion" value="12345678.01" />
通过。
<add key="BuildVersion" value="12345678.02" />
我写下了波纹管代码,但它总是让我回声。
set/p pass="%pass%"
set "number_to_round=%pass%"
for /f "tokens=1,2 delims=." %%a in ("%number_to_round%") do (
set first_part=%%a
set second_part=%%b
)
set second_part=%second_part:~0,1%
echo %second_part%
if defined second_part if %second_part% GEQ 5 (
set /a rounded=%second_part%+1
) else (
set /a rounded=%second_part%
)
echo %rounded%>newVersionbeafterdecimal.txt
答案 0 :(得分:0)
如果小数部分总是有2位数,则更容易:
1.unsigned short port = 8080;
2.ServerSocket ServerSocket(port);
3.Timespan timeout(3000);
4.ParallelSocketReactor reactor;
5.ParallelSocketAcceptor<MyHandler> acceptor(ServerSocket, reactor);
6.reactor.run();
插入回波线以显示正在扯动的东西,可以将其删除。
示例运行:
@Echo off
set/p "pass=Version number %pass%"
If "%pass:~-3,1%" neq "." (Echo Invalid version number %pass% &Pause&Goto :Eof)
Echo pass=%pass%
Set /A pass=%pass:.=% + 1
Echo pass=%pass%
Set "pass=%pass:~0,-2%.%pass:~-2%"
Echo pass=%pass%
echo %pass%>newVersion.txt