ha
BAN USERha
# Ruby code
str = "career cup."
str_length = str.length
result = {}
start_chr_pos = curr_chr_pos = 0
while curr_chr_pos < str_length + 1 do
if str[curr_chr_pos] === " " || curr_chr_pos == str_length
result[str[start_chr_pos..curr_chr_pos-1]] = curr_chr_pos - start_chr_pos
start_chr_pos = curr_chr_pos + 1
end
curr_chr_pos += 1
end
puts result
>> {"career"=>6, "cup."=>4}
# ========== Very short form
# puts str.split(" ").inject(Hash.new { |h,k| h[k] = []}) { |h,s| h[s] << s.length; h}
RepGlennaJames, Android test engineer at Accenture
Glenna , an illustrator for more than 8 years in California . I also feel I could have an actual understanding of ...
Repbarrondanielle057, Android test engineer at A9
My name is Danielle and I am working as a Contract manager. I love this job.and nowadays I am ...
Repelmothure, Backend Developer at ABC TECH SUPPORT
Social work is a practice-based profession that promotes social change, development, cohesion and the empowerment of people and communities. Social ...
Rep
Repathenajbarnarda, Android Engineer at ABC TECH SUPPORT
I am a graduate in Civil Engineering with nearly 7 years of experience in planning and implementing technical solutions for ...
RepAtharvFlores, Accountant at A9
I am working as a position of a court clerk to assist the judges as attorneys in expediting the court ...
Repstephanielstokes45, Android Engineer at ABC TECH SUPPORT
Hey, my name is Stephanie and I completed all my study from California. And Nowadays I am working as a ...
Repdorothylopez7485, Analyst at ABC TECH SUPPORT
My name is Dorothy and I am a Host. Nowadays I am doing a new experiment like spell to keep ...
ANY (or its synonym SOME) is a syntax sugar for EXISTS with a simple correlation:
- ha July 23, 2012SELECT *
FROM mytable
WHERE x <= ANY
(
SELECT y
FROM othertable
)
is the same as:
SELECT *
FROM mytable m
WHERE EXISTS
(
SELECT NULL
FROM othertable o
WHERE m.x <= o.y
)
With the equality condition on a not-nullable field, it becomes similar to IN.
All major databases, including SQL Server, MySQL and PostgreSQL, support this keyword.
Source: stackOverFlow