Folks are often using two different numbers as leg length. For buying a bike, leg length is the measurement from a level floor up to the pubic bone. A person who wears 28 inch inseam slacks might have a "bike" leg length of 30 inches or 31 inches.
A starting place in bike fit is to go to the bike store with the shoes you will use for riding, or just some thick soled running shoes. Stand flat footed over the bike as close to the stem as you can get. If the top bar brushes against the crotch of your jeans, that bike might be in your size range. If the top bar presses against your crotch enough to be unpleasant, that bike is too tall.
Many bikes, especially hybrids and mountain bikes, have a top bar that slopes down sharply from the stem back to the seat tube. That means that even if you can "just" barely stand over a bike when you are up against the stem, you will have a lot of clearance when you are standing closer to the saddle.
Figure out what style of bike you want: a mountain bike, a hybrid, or a road bike. Then have two or three shops give you their thoughts on the best size. Compare their advice and ignore shops who would put you on bikes that are much smaller or larger than the majority of shops suggest.
New riders often report severe pain in the neck, back and hands. That is because their shop has set up the bars to be three or four inches lower than the saddle, forcing the rider down into a position with their nose against the front tire. If a bike will not allow you to have the option to set the bars level with the top of the saddle, that bike is too small, and you will never be able to get comfortable on that bike.
A new rider will be most comfortable with the bars level with the saddle. As the rider gets stronger and more experienced, the time may come to lower the bars an inch or two. But, the "day one" position that works best is with the bars level with the top of the saddle.