Questions tagged [leading-zero]
276 questions
-2
votes
1 answer
Is there a work around for using a leading zero for a password "0123" in Kotlin?
This password has been used for many years so I cannot change it without ire from employees. The original code was done in Java which allows a leading zero. Is there any way I can still use the password "0123" in Kotlin? I have the password saved as…

Altohombre
- 21
- 5
-2
votes
1 answer
Leading '0' error in Python in spite of its absence
from dateutil.parser import parse
import re
from datetime import datetime
def date_fun(date):
try:
dt = parse(date)
dt = dt.strftime('%d/%m/%Y')
dmy_split=re.split('[- / ]', dt)
# error here:
if (eval(dmy_split[0])>=1 and…

Laxmi Ty
- 3
- 4
-2
votes
1 answer
How to add a leading 0 to column number?
I'm trying to add a leading 0 to a numeric column.
The problem is not all numeric columns are recognized as they are.
Sub AddZero()
Dim MyRange As Object
Dim celle As Range
Dim i As Integer
Dim Result As String
Dim StrLen As…

MrSamael
- 5
- 2
-2
votes
1 answer
Counting leading zeros
I have a basic function:
return len(a) - len(str(int(a)))
When this is run against the value of: 0000
It returns 3 rather than 4.
I really do not understand why, can someone please clarify?

ChristAHFER
- 5
- 4
-2
votes
2 answers
How to add leading zeroes to format?
I need a print function that writes Loop i / round, where both values i and round have to have at least four digits (12 -> 0012). It must have the format-method too.
I found the paste formatC and other ways to add leading zeroes but I can't make…

Pearl P
- 1
-2
votes
3 answers
Convert String to DateTime with Leading Zero C#
I have a datetime in the format MM/dd/yyyy:
string datetime = "05/16/2018"
Now, as per the requirement, I need to convert this string to DateTime. Whenever I do so It removes leading zero.
DateTime dt = DateTime.Parse(datetime,…

Jeeten Parmar
- 5,568
- 15
- 62
- 111
-2
votes
3 answers
Leading Zeros used in int
I am trying to complete a program but the leading zero gets removed when it is a read as an int. I need this leading zero in the event a user enters a zero at the start because I am using it to do math with later in the program and can't just add…

Alec Mauro
- 9
- 1
- 3
-2
votes
1 answer
How To Prevent Invoke-SQLCMD from trimming Leading Zero's
In powershell I have a script and every time it runs it needs to increment a number in a DB by one. Once it reaches 9999 it resets back to 0001.
I have this functionality worked out in powershell my issue is that Invoke-SQLCMD
keeps stripping out…

Cleadus Fetus
- 113
- 8
-2
votes
4 answers
Add leading zeros twice in filename
I have file names (from image tiles) consisting of two numbers separated by an underscore, e.g.
142_27.jpg
7_39.jpg
1_120.jpg
How can I (in linux) add leading zeros to both of these numbers? What I want is the file names…

user1583209
- 1,637
- 3
- 24
- 42
-2
votes
1 answer
Batch rename - remove parentheses and whitespace and have leading zero
so I know there are like a million similar questions (but sadly not quite the same, as always), but since I'm fairly new to Powershell and have real trouble with its syntax I hope someone is willing to help me out
I already prepared the files I have…

SuperSpitter
- 177
- 2
- 8
-2
votes
2 answers
Binary numbers with leading zeros
I've been working on an assignment where I've to use bitwise operators to (OR, AND, or NOT )
the Program has a fixed 4X4 matrix and the user suppose to enter a query to the program ANDing two BINARY numbers, ORing them ...etc
the problem is the…

Rawan.S
- 29
- 1
- 5
-3
votes
1 answer
Select only those rows from a column where column 2 has more than 2 leading zeroes in Linux
So I want to grab only the rows that has 2 or more than 2 leading zeroes in the ID column ($2) between the 5th and 10th character. For example column 2 has ID 156700923134, so from 5th to 10th character 1567-009231-34 i.e. 009231. In this case we…

HKohin
- 27
- 4
-3
votes
2 answers
Add leading zero if number is under 10 in PHP
I would like to create a pagination with leading zeros, if the number is under 10:
< 07 08 09 10 11 >
My pagination outputs similar HTML:
-3
votes
3 answers
c++ converting int to char + add leading zeros to char
I got numbers from 0 to 999. How can I achieve the following
int i = 123;//possible values 0-999
char i_char[3] = /*do conversion of int i to char and add 3 leading zeros*/
Example(s): i_char shall look like "001" for i=1, "011" for i=11 or "101"…

SemtexB
- 660
- 6
- 21
-3
votes
1 answer
How do I split in python with leading 0
I'm trying to split a string with leading 0s, and I got a lot of invalid tokens. I understand python will interpret leading 0 as octal number.
What I want to do is to split "Jan-01,2005" into ['Jan-01','2005']. I tried to convert it to string, but…

Qianqi Shen
- 1
- 2