我有一个源文件,其中添加了2个功能.为了允许采摘樱桃,我想分两个阶段:每个功能一个.到目前为止,在类似的情况下,使用git add -p我很好,提交一个功能,同时将本地文件留在最后阶段.
但是,我现在git add -p遇到了一个问题,即想要包含两个功能的编辑.即使编辑是在单独的行上,s(对于"拆分")不再想要将大块分成更小的部分......
简而言之:我无法通过这种方式分离2个功能的更改.有没有办法手动编辑补丁,例如使用vi,而不实际更改原始文件?
我正在尝试找到一种有效的,通用的方法来将字符串转换为PL/SQL中的数字,其中NLS_NUMERIC_CHARACTERS设置的本地设置是不可预测的 - 并且我不会触及它.输入格式是编程标准"123.456789",但小数点两边的位数未知.
select to_number('123.456789') from dual;
-- only works if nls_numeric_characters is '.,'
select to_number('123.456789', '99999.9999999999') from dual;
-- only works if the number of digits in the format is large enough
-- but I don't want to guess...
Run Code Online (Sandbox Code Playgroud)
to_number 接受第三个参数,但在这种情况下你也要指定第二个参数,并且没有"默认"的格式规范......
select to_number('123.456789', null, 'nls_numeric_characters=''.,''') from dual;
-- returns null
select to_number('123.456789', '99999D9999999999', 'nls_numeric_characters=''.,''') from dual;
-- "works" with the same caveat as (2), so it's rather pointless...
Run Code Online (Sandbox Code Playgroud)
还有另一种使用PL/SQL的方法:
CREATE OR REPLACE
FUNCTION STRING2NUMBER (p_string varchar2) RETURN NUMBER
IS …Run Code Online (Sandbox Code Playgroud)