I am trying to write a regex that converts hours to minutes. I currently have a value that gives me the number of hours to a point and the number of minutes after a point, for example 6.10 is 6 hours and 10 minutes.
Is it possible to use a regular expression to find the value before the point and multiply by 60 (to get the minutes), and then add the value after the point (which is already in minutes)?
So, as in the previous example, this would do: (6 * 60) + 10
Thank!
, , . , - INDEX, SUBSTR, .
:
select INDEX([yourstring], '.')
( ):
select SUBSTR([yourstring], 1, INDEX([yourstring], '.') - 1)
select SUBSTR([yourstring], INDEX([yourstring], '.') + 1)
"6.10" , :
SET @Input = CAST(@InputString AS FLOAT)
Modulus .
= * 100 + * 60.
, 6.10 @Input,
6.10
SET @Output = (@Input % 1) * 100 + FLOOR(@Input, 0) * 60
, - :
SELECT (Input % 1) * 100 + FLOOR(Input, 0) * 60 Output FROM Table
, , . 6 = 6,05. (6 = 6,5), , under.
There is a function STRTOKto tokenize the string, and then simply:
STRTOK
select '12.34' as x, cast(strtok(x,'.',1) as int) * 60 + cast(strtok(x,'.',2) as int)
Source: https://habr.com/ru/post/1661644/More articles:Nonsmooth and non-differentiable loss tensor function - tensorflowIOS universal links not working? - iosC ++ How to declare a class as a local file - c ++Respond to explicit Instagram authentication - authenticationhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1661643/cant-install-any-packages-to-npm-or-bower&usg=ALkJrhj4QH1vXyv47Dg7gURpTMdhhY99kgOAuth redirect URI alternatives for non-web applications? - redirectувеличить значение элемента в массиве vba - arraysHandling multiple states in a C ++ class - c ++Spring-boot: The required part of the file request is missing - angularjspandas calculation ewm.std - pythonAll Articles